Part Number Hot Search : 
MP02X130 GP140F8K MMBTA92 8069CCZR B8247 67BZI XN0F263 2SC29
Product Description
Full Text Search
 

To Download HD6417706BP133V Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  revision date: mar. 22, 2004 32 sh7706 group hardware manual renesas 32-bit risc microcomputer superh ? risc engine family/sh7700 series rev.4.00 rej09b0146-0400o
rev. 4.00, 03/04, page ii of xlvi 1. these materials are intended as a reference to assist our customers in the selection of the renesas technology corp. product best suited to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to renesas technology corp. or a third party. 2. renesas technology corp. assumes no responsibility for any damage, or infringement of any third- party's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or circuit application examples contained in these materials. 3. all information contained in these materials, including product data, diagrams, charts, programs and algorithms represents information on products at the time of publication of these materials, and are subject to change by renesas technology corp. without notice due to product improvements or other reasons. it is therefore recommended that customers contact renesas technology corp. or an authorized renesas technology corp. product distributor for the latest product information before purchasing a product listed herein. the information described here may contain technical inaccuracies or typographical errors. renesas technology corp. assumes no responsibility for any damage, liability, or other loss rising from these inaccuracies or errors. please also pay attention to information published by renesas technology corp. by various means, including the renesas technology corp. semiconductor home page (http://www.renesas.com). 4. when using any or all of the information contained in these materials, including product data, diagrams, charts, programs, and algorithms, please be sure to evaluate all information as a total system before making a final decision on the applicability of the information and products. renesas technology corp. assumes no responsibility for any damage, liability or other loss resulting from the information contained herein. 5. renesas technology corp. semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake. please contact renesas technology corp. or an authorized renesas technology corp. product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. 6. the prior written approval of renesas technology corp. is necessary to reprint or reproduce in whole or in part these materials. 7. if these products or technologies are subject to the japanese export control restrictions, they must be exported under a license from the japanese government and cannot be imported into a country other than the approved destination. any diversion or reexport contrary to the export control laws and regulations of japan and/or the country of destination is prohibited. 8. please contact renesas technology corp. for further details on these materials or the products contained therein. 1. renesas technology corp. puts the maximum effort into making semiconductor products better and more reliable, but there is always the possibility that trouble may occur with them. trouble with semiconductors may lead to personal injury, fire or property damage. remember to give due consideration to safety when making your circuit designs, with appropriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of nonflammable material or (iii) prevention against any malfunction or mishap. keep safety first in your circuit designs! notes regarding these materials
rev. 4.00, 03/04, page iii of xlvi general precautions on handling of product 1. treatment of nc pins note: do not connect anything to the nc pins. the nc (not connected) pins are either not connected to any of the internal circuitry or are they are used as test pins or to reduce noise. if something is connected to the nc pins, the operation of the lsi is not guaranteed. 2. treatment of unused input pins note: fix all unused input pins to high or low level. generally, the input pins of cmos products are high-impedance input pins. if unused pins are in their open states, intermediate levels are induced by noise in the vicinity, a pass- through current flows internally, and a malfunction may occur. 3. processing before initialization note: when power is first supplied, the product?s state is undefined. the states of internal circuits are undefined until full power is supplied throughout the chip and a low level is input on the reset pin. during the period where the states are undefined, the register settings and the output state of each pin are also undefined. design your system so that it does not malfunction because of processing while it is in this undefined state. for those products which have a reset function, reset the lsi immediately after the power supply has been turned on. 4. prohibition of access to undefined or reserved addresses note: access to undefined or reserved addresses is prohibited. the undefined or reserved addresses may be used to expand functions, or test registers may have been be allocated to these addresses. do not access these registers; the system?s operation is not guaranteed if they are accessed.
rev. 4.00, 03/04, page iv of xlvi configuration of this manual this manual comprises the following items: 1. general precautions on handling of product 2. configuration of this manual 3. preface 4. contents 5. overview 6. description of functional modules ? cpu and system-control modules ? on-chip peripheral modules the configuration of the functional description of each module differs according to the module. however, the generic style includes the following items: i) feature ii) input/output pin iii) register description iv) operation v) usage note when designing an application system that includes this lsi, take notes into account. each section includes notes in relation to the descriptions given, and usage notes are given, as required, as the final part of each section. 7. list of registers 8. electrical characteristics 9. appendix 10. main revisions and additions in this edition (only for revised versions) the list of revisions is a summary of points that have been revised or added to earlier versions. this does not include all of the revised contents. for details, see the actual locations in this manual. 11. index
rev. 4.00, 03/04, page v of xlvi preface the sh7706 risc (reduced instruction set computer) microcomputer includes a renesas technology-original risc cpu as its core, and the peripheral functions required to configure a system. target users: this manual was written for users who will be using this lsi in the design of application systems. users of this manual are expected to understand the fundamentals of electrical circuits, logical circuits, and microcomputers. objective: this manual was written to explain the hardware functions and electrical characteristics of this lsi to the above users. refer to the sh-3/sh-3e/sh3-dsp programming manual for a detailed description of the instruction set. notes on reading this manual: ? product names the following products are covered in this manual. product classifications and abbreviations basic classification product code sh7706 (176-pin plastic lqfp) hd6417706f133 sh7706 (208-pin plastic tfbga) HD6417706BP133V ? in order to understand the overall functions of the chip read the manual according to the contents. this manual can be roughly categorized into parts on the cpu, system control functions, peripheral functions and electrical characteristics. ? in order to understand the details of the cpu's functions read the sh-3/sh-3e/sh3-dsp programming manual.
rev. 4.00, 03/04, page vi of xlvi rules: register name: the following notation is used for cases when the same or a similar function, e.g. serial communication, is implemented on more than one channel: xxx_n (xxx is the register name and n is the channel number) bit order: the msb (most significant bit) is on the left and the lsb (least significant bit) is on the right. number notation: binary is b'xxxx, hexadecimal is h'xxxx, decimal is xxxx. signal notation: an overbar is added to a low-active signal: xxxx related manuals: the latest versions of all related manuals are available from our web site. please ensure you have the latest versions of all documents you require. http://www.renesas.com/eng/ sh7706 manuals: document title document no. sh7706 hardware manual this manual sh-3/sh-3e/sh3-dsp programming manual ade-602-096 users manuals for development tools: document title document no. sh series c/c++ compiler, assembler, optimizing linkage editor user's manual ade-702-246 sh series simulator/debugger (for windows) user's manual ade-702-186 sh series simulator/debugger (for unix) user's manual ade-702-203 high-performance embedded workshop user's manual ade-702-201 sh series high-performance embedded workshop, high-performance debugging interface tutorial ade-702-230
rev. 4.00, 03/04, page vii of xlvi abbreviations acia asynchronous communication interface adapter adc analog to digital converter aud advanced user debugger bsc bus state controller cpg clock pulse generator cmt compare match timer dac digital to analog converter dma direct memory access dmac direct memory access controller dram dynamic random access memory etu elementary time unit fifo first-in first-out h-udi user debugging interface intc interrupt controller jeida japan electronic industry development association jtag joint test action group lru least recently used lsb least significant bit mmu memory management unit msb most significant bit pcmcia personal computer memory card international association pfc pin function controller pll phase locked loop risc reduced instruction set computer rom read only memory rtc realtime clock
rev. 4.00, 03/04, page viii of xlvi sci serial communication interface scif serial communication interface with fifo sram static random access memory tlb translation lookaside buffer tmu timer unit uart universal asynchronous receiver/transmitter ubc user break controller wdt watchdog timer
rev. 4.00, 03/04, page ix of xlvi main revisions and additions in this edition item page revision (see manual for details) 1.2 block diagram figure 1.1 pin assignment ( tbp-208a) 4 figure 1.1 title amended package name amended number of pins fp-176c tbp-208a pin name 1.4 pin function 6 to 12 9 description amended chip select 0 2.1.4 control registers 18 ? status register (sr) description of bit 29 amended register bank bit determines the bank of general registers r0 to r7 used in privileged mode. 2.3.2 addressing modes table 2.2 addressing modes and effective addresses 26 note amended note: for the addressing modes below that use a displacement (disp), the assembler descriptions in this manual show the value before scaling ( 1, 2, or 4) is performed according to the operand size. this is done to clarify the operation of the lsi. refer to the relevant assembler notation rules for the actual assembler descriptions. 2.4.1 instruction set classified by function table 2.7 logic operation instructions 38 table 2.7 amended instruction operation code privileged mode cycles t bit tas.b @rn * if (rn) is 0, 1 0100nnnn00011011 ?4 test result
rev. 4.00, 03/04, page x of xlvi item page revision (see manual for details) 2.4.1 instruction set classified by function table 2.10 system control instructions 41 to 43 table 2.10 amended instruction operation code privileged mode cycles t bit clrmac 0 0000000000101000 ? 1 ? clrs 0 0000000001001000 ? 1 ? clrt 0 0000000000001000 ? 10 ldc rm,sr rm 0100mmmm00001110 ldc rm,gbr rm 0100mmmm00011110 ? 3 ? ldc rm,vbr rm 0100mmmm00101110 ldc rm,ssr rm 0100mmmm00111110 ldc rm,spc rm 0100mmmm01001110 ldc rm,r0_bank rm 0100mmmm10001110 ldc rm,r1_bank rm 0100mmmm10011110 ldc rm,r2_bank rm 0100mmmm10101110 ldc rm,r3_bank rm 0100mmmm10111110 ldc rm,r4_bank rm 0100mmmm11001110 ldc rm,r5_bank rm 0100mmmm11011110 ldc rm,r6_bank rm 0100mmmm11101110 ldc rm,r7_bank rm 0100mmmm11111110 ldc.l @rm+,sr (rm) 0100mmmm00000111 ldc.l @rm+,gbr (rm) 0100mmmm00010111 ? 5 ? ldc.l @rm+,vbr (rm) 0100mmmm00100111 ldc.l @rm+,ssr (rm) 0100mmmm00110111 ldc.l @rm+,spc (rm) 0100mmmm01000111 ldc.l @rm+, r0_bank (rm) 0100mmmm10000111 ldc.l @rm+, r1_bank (rm) 0100mmmm10010111 ldc.l @rm+, r2_bank (rm) 0100mmmm10100111 ldc.l @rm+, r3_bank (rm) 0100mmmm10110111 ldc.l @rm+, r4_bank (rm) 0100mmmm11000111 ldc.l @rm+, r5_bank (rm) 0100mmmm11010111 ldc.l @rm+, r6_bank (rm) 0100mmmm11100111 ldc.l @rm+, r7_bank (rm) 0100mmmm11110111 pref @rm (rm) 0000mmmm10000011 ? 2 ? stc.l sr,@ ? rn rn ? 4 0100nnnn00000011 stc.l gbr,@ ? rn rn ? 4 0100nnnn00010011 ? 2 ? stc.l vbr,@ ? rn rn ? 4 0100nnnn00100011 stc.l ssr,@ ? rn rn ? 4 0100nnnn00110011 stc.l spc,@ ? rn rn ? 4 0100nnnn01000011 trapa #imm pc 11000011iiiiiiii ? 8 ? 2.4.2 instruction code map table 2.11 instruction code map 45 table 2.11 amended instruction code fx: 0000 fx: 0001 fx: 0010 fx: 0011 to 1111 msb lsb md: 00 md: 01 md: 10 md: 11 0000 rn fx 0000 0000 rn fx 0001 0000 rn 00md 0010 stc sr,rn stc gbr,rn stc vbr,rn stc ssr,rn 0000 rn 01md 0010 stc spc,rn 0000 rn 10md 0010 stc r0_bank,rn stc r1_bank,rn stc r2_bank,rn stc r3_bank,rn 0000 rn 11md 0010 stc r4_bank,rn stc r5_bank,rn stc r6_bank,rn stc r7_bank,rn 0000 rm 00md 0011 bsrf rm braf rm 0000 rm 10md 0011 pref @rm 0000 rn rm 01md mov.b rm,@(r0,rn) mov.w rm,@(r0,rn) mov.l rm,@(r0,rn) mul.l rm,rn
rev. 4.00, 03/04, page xi of xlvi item page revision (see manual for details) 3.3.2 tlb indexing 61 description added the tlb uses a 4-way set associative scheme, so entries must be selected by index. vpn bits 16 to 12 and asid bits in pteh 4 to 0 are used as the index number regardless of the page size. 3.5.2 tlb protection violation exception 71 description added software (tlb protection violation handler) operations: software resolves the tlb protection violation and issues the rte (return from exception handler) instruction to terminate the handler and return to the instruction stream. note that the rte instruction should be issued after the two instructions following the ldtlb instruction. 3.6.3 usage examples 78 description deleted invalidating specific entries: specific tlb entries can be invalidated by writing 0 to the entry's v bit. r0 specifies the write data and r1 specifies the address. 6.4.4 interrupt request register 0 (irr0) 126 bit 5 r/w amended (before) r (after) r /w 8.3 area overview figure 8.2 corresponding to logical address space and physical address space 163 note amended note: for logical address spaces p0 and p3, when the memory management unit (mmu) is on, it can optionally generate a physical address for the logical address. it can be applied when the mmu is off and when the mmu is on and each physical address for the logical address is equal except for upper three bits. see table 8.2, physical address space map, for information on converting logical addresses into user-defined physical addresses. 8.4.6 pcmcia control register (pcr) 185 bit table of bits 11, 7, 6 amended bit * bit name initial value r/w 13, 12 ? all 0 r 11 7 6 a5ted2 a5ted1 a5ted0 0 0 0 r/w r/w r/w 8.5.2 description of areas 197 description added the number of bus cycles is selected between 0 and 10 wait cycles using the a0w2 to a0w0 bits of wcr2. in addition, any number of waits can be inserted in each bus cycle by means of the external wait pin ( wait ). when the burst function is used, the bus cycle pitch of the burst cycle is determined within a range of 2 to 10 according to the number of waits.
rev. 4.00, 03/04, page xii of xlvi item page revision (see manual for details) 9.3 register description 246 description added channel 3 ? dma source address register 3 (sar3) ? dma destination address register 3 (dar3) ? dma transfer count register 3 (dmatcr3) ? dma channel control register 3 (chcr3) any channel ? dma operation register (dmaor) 9.5.3 operation figure 9.27 counter operation 285 figure 9.27 amended (before) cmcnt 0 value (after) cmcnt value (before) cmcor 0 (after) cmcor 10.1 feature figure 10.1 block diagram of clock pulse generator 292 figure 10.1 amended cap1 ckio cycle = bcyc cap2 xtal extal pll circuit 1 ( 293 5. description amended 5. divider 2: divider 2 generates a clock at the operating frequency used by the bus clock (b ) and peripheral clock (p ). the operating frequency of the peripheral clock can be 1, 1/2, 1/3, 1/4, or 1/6 times the output frequency of pll circuit 1, as long as it stays at or below the clock frequency of the ckio pin. the division ratio is set in the frequency control register.
rev. 4.00, 03/04, page xiii of xlvi item page revision (see manual for details) 10.3 clock operating modes 294 description amended table 10.2 shows the relationship between the mode control pin (md2 to md0) combinations and the clock operating modes. table 10.3 shows the usable frequency ranges in the clock operating modes and frequency ranges of the input clock (crystal oscillation). operation cannot be guaranteed if settings other than those listed in table 10.3 are used. 297 caution 4 amended 4. the frequency of the peripheral clock ( p ): ? the frequency of the peripheral clock ( p ) is the product of the frequency of the ckio pin, the frequency multiplication ratio of pll circuit 1, and the division ratio of divider 2. section 11 watchdog timer (wdt) figure 11.1 block diagram of the wdt 303 figure 11.1 amended wtcsr standby control bus interface wtcnt divider clock selector clock standby mode peripheral clock standby cancellation reset control clock selection wdt overflow internal reset request interrupt control interrupt request 11.2.1 watchdog timer counter (wtcnt) 304 description amended the wtcnt is initialized to h'00 only by a power-on reset through the resetp pin. 11.2.2 watchdog timer control/status register (wtcsr) 304 description amended the wtcsr is initialized to h'00 only by a power-on reset through the resetp pin. 12.5.2 status flag clear timing figure 12.9 status flag clear timing 323 figure 12.9 amended p 13.3.9 second alarm register (rsecar) 333 bit 7 r/w amended (before) r (after) r /w
rev. 4.00, 03/04, page xiv of xlvi item page revision (see manual for details) 13.4.2 setting time figure 13.2 setting the time 341 figure 13.2 amended write 0 to start and 1 to reset in the rcr2 register order is irrelevant write 1 to start in the rcr2 register set seconds, minutes, hour, day, day of the week, month and year stop clock, reset divider circuit to reset the divider circuit (rtc prescaler and r64cnt) and set the counter start clock 13.4.3 reading the time figure 13.3 reading the time 342 figure 13.3 amended write 0 to cf in rcr1 note: set af to 1 so that alarm flag is not cleared. write 0 to cie in rcr1 read rcr1 and check cf carry flag = 1? no yes clear the carry flag disable the carry interrupt read counter register to read the time without using interrupts (a) 13.4.4 alarm function figure 13.4 using the alarm function 343 figure 13.4 amended set alarm time always reset, since the flag may have been set while the alarm time was being set (af bit in rcr1 is cleared). clear alarm flag 14.1 feature 347 description added the sci has the following features. ? selectable from asynchronous or clock synchronous as the serial communications mode
rev. 4.00, 03/04, page xv of xlvi item page revision (see manual for details) 14.4.3 clock synchronous operation figure 14.17 data format in clock synchronous communication 389 figure 14.17 amended bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 lsb msb serial data don't care don't care 17.1.6 port f control register (pfcr) 470 bit table amended bit bit name initial value r/w description 15 ? 1/0 r reserved when asemd0 = 0, this bit is always read as 0 and must only be written with 0. when asemd0 = 1, this bit is always read as 1 and must only be written with 1. 14 ? 0 r reserved this bit is always read as 0 and must only be written with 0. 13 12 pf6md1 pf6md0 1/0 0 r/w r/w pf6 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 11 10 pf5md1 pf5md0 1/0 0 r/w r/w pf5 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 471 bit bit name initial value r/w description 9 8 pf4md1 pf4md0 1/0 0 r/w r/w pf4 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 7 6 pf3md1 pf3md0 1/0 0 r/w r/w pf3 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 5 4 pf2md1 pf2md0 1/0 0 r/w r/w pf2 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 3 2 pf1md1 pf1md0 1/0 0 r/w r/w pf1 mode 1 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 1 0 pf0md1 pf0md0 1/0 0 r/w r/w pf0 mode 1 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page xvi of xlvi item page revision (see manual for details) 17.1.7 port g control register (pgcr) 472 bit table amended 11 10 pg5md1 pg5md0 1 0 9 8 pg4md1 pg4md0 1/0 0 7 6 pg3md1 pg3md0 1/0 0 5 4 pg2md1 pg2md0 1/0 0 3 2 pg1md1 pg1md0 1/0 0 bit bit name initial value 473 bit bit name initial value 1 0 pg0md1 pg0md0 1/0 0 18.5.2 port e data register (pedr) 485 description amended pedr is initialized to h'00 by a power-on reset , after which the general input port function (pull-up mos on) is set as the initial pin function, and the corresponding pin levels are read. it retains its previous value in standby mode and sleep mode, and in a manual reset. 19.3.2 a/d control/status register (adcsr) 499 bit 7 r/w amended (before) r/(w) * (after) r/(w) * 1 500 bit 4 description amended multi scn 0 0 :single mode 0 1 :single mode 1 0 :multi mode 11: scan mode note * 2 added bit 3 clock select 0: conversion time = 536 states (maximum) 1: conversion time = 266 states (maximum) * 2 notes: 1. only 0 can be written to clear the flag. 2 the cks value should be set so that the a/d conversion time is 16 s(minimum).
rev. 4.00, 03/04, page xvii of xlvi item page revision (see manual for details) 19.4 bus master interface figure 19.2 a/d data register access operation (reading h'aa40) 502 figure 19.2 amended bus interface temp (h'40) cpu (h'40) lower byte read module internal data bus lower byte of a/d data register (h'40) upper byte of a/d data register (h'aa) 19.6.3 scan mode (multi = 1, scn = 1) figure 19.7 example of a/d converter operation (scan mode, channels an0 to an2 selected) 507 figure 19.7 amended set * 1 clear * 1 addra * 2 addrb * 2 addrc * 2 addrd * 2 notes: 1. downward arrows indicate instruction executed by software. 2. data is ignored during conversion. 19.6.4 input sampling and a/d conversion time 508 description deleted in multi mode and scan mode, the values given in table 19.3 apply to the first conversion. in the second and subsequent conversions the conversion time is fixed at 512 states when cks = 0 or 256 states when cks = 1. 19.9.1 setting analog input voltage 511 description amended ? analog input voltage range: during a/d conversion, the voltages input to the analog input pins ann should be in the range av ss ann av cc (n = 0 to 3). ? av cc , avss , input voltage: avcc and avss should be related as follows: avcc = vccq 0.2 v and avss = vss . 21.3.3 boundary scan register (sdbsr) table 21.2 this lsi's pins and boundary scan register bits 522 table 21.2 amended bit 171 i/o (before) (blank) (after) out bit 160 i/o (before) out (after) control 21.4.1 tap controller 525 note amended note: the tdo is at high impedance, except with shift-dr (shift- sr) and shift-ir states. when trst = 0, there is a transition to test- logic-reset asynchronously with tck.
rev. 4.00, 03/04, page xviii of xlvi item page revision (see manual for details) 531 table 22.1 amended mode transition conditions canceling procedure section 22 power-down modes table 22.1 power-down modes module standby function set mstp bit of stbcr to 1 1. clear mstp bit to 0 2. power-on reset 22.3.3 module standby function 539 ? transition to module standby function description amended setting the standby control register mstp8 to mstp4, mstp2 to mstp0 bits to 1 halts the supply of clocks to the corresponding on- chip supporting modules. this function can be used to reduce the power consumption in normal mode and sleep mode. ? clearing the module standby function description amended the module standby function can be cleared by clearing the mstp8 to mstp4, mstp2 to mstp0 bits to 0, or by a power-on reset or manual reset. 23.1 register address map 548 address of sdmr amended (before) h'ffffd000 to h'ffffeff e (after) h'ffffd000 to h'ffffeff f 24.3.4 basic timing figure 24.16 basic bus cycle (no wait) 585 figure 24.16 amended bs t bsd t bsd t dakd1 t dakd2 dackn
rev. 4.00, 03/04, page xix of xlvi item page revision (see manual for details) figure 24.18 basic bus cycle (external wait) 587 figure 24.18 amended d31 to d0 (read) wen d31 to d0 (write) bs wait t wed t wts t wth t bsd t bsd t rds1 t wts t wth t wed t rwh t ah t wdh3 t wdh1 t dakd1 t dakd2 dackn t wdd1 (write) 24.3.6 synchronous dram timing figure 24.30 synchronous dram burst read bus cycle (ras down, same row address, cas latency = 1) 599 figure 24.30 replaced 24.3.9 h-udi, aud related pin timing figure 24.57 h-udi data transfer timing 619 figure 24.57 amended t tdod tdo 24.3.11 ac characteristics measurement conditions 622 description amended i/o signal reference level: vccq/2 ( vccq = 3.3 0.3 v, vcc = 1.9 0.15v) ? input pulse level b.1 pin functions table b.1 pin states during resets, power-down states, and bus-released state 630 table b.1 amended reset power-down category pin power-on reset manual reset standby sleep bus released d[15:0] z i z io z d[23:16]/pta[7:0] z ip * 3 zk * 3 iop * 3 zp * 3 data bus d[31:24]/ptb[7:0] z ip * 3 zk * 3 iop * 3 zp * 3 b.3 processing of unused pins 637 description amended when extal pin is not used ? extal: pull up to vccq or vss
rev. 4.00, 03/04, page xx of xlvi item page revision (see manual for details) b.4 pin states in access to each address space table b.8 pin states (synchronous dram/big endian) 647 table b.8 amended 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access d23 to d16 invalid data valid data invalid data invalid data valid data invalid data valid data d31 to d24 valid data invalid data invalid data invalid data valid data invalid data valid data
rev. 4.00, 03/04, page xxi of xlvi contents section 1 overview........................................................................................... 1 1.1 feature..................................................................................................................... .......... 1 1.2 block diagram ................................................................................................................ .. 3 1.3 pin assignment ............................................................................................................... .. 4 1.4 pin function ................................................................................................................. ..... 6 section 2 cpu................................................................................................... 13 2.1 register description......................................................................................................... .13 2.1.1 privileged mode and banks ................................................................................. 13 2.1.2 general registers ................................................................................................. 15 2.1.3 system registers.................................................................................................. 16 2.1.4 control registers ................................................................................................. 17 2.2 data formats ................................................................................................................. .... 20 2.2.1 data format in registers...................................................................................... 20 2.2.2 data format in memory....................................................................................... 20 2.3 instruction features......................................................................................................... .. 21 2.3.1 execution environment........................................................................................ 21 2.3.2 addressing modes ............................................................................................... 23 2.3.3 instruction formats .............................................................................................. 27 2.4 instruction set .............................................................................................................. ..... 30 2.4.1 instruction set classified by function ................................................................. 30 2.4.2 instruction code map .......................................................................................... 46 2.5 processor states and processor modes.............................................................................. 49 2.5.1 processor states ................................................................................................... 49 2.5.2 processor modes .................................................................................................. 50 section 3 memory management unit (mmu) ................................................. 51 3.1 role of mmu................................................................................................................... .51 3.1.1 this lsi's mmu .................................................................................................. 53 3.2 register description......................................................................................................... .56 3.2.1 page table entry register high (pteh) ............................................................. 56 3.2.2 page table entry register low (ptel) .............................................................. 57 3.2.3 the translation table base register (ttb)........................................................ 57 3.2.4 the tlb exception address register (tea) ...................................................... 57 3.2.5 mmu control register (mmucr) ..................................................................... 58 3.3 tlb functions ................................................................................................................ .. 59 3.3.1 configuration of the tlb .................................................................................... 59 3.3.2 tlb indexing....................................................................................................... 61 3.3.3 tlb address comparison ................................................................................... 62
rev. 4.00, 03/04, page xxii of xlvi 3.3.4 page management information............................................................................ 64 3.4 mmu functions................................................................................................................ 65 3.4.1 mmu hardware management ............................................................................. 65 3.4.2 mmu software management .............................................................................. 65 3.4.3 mmu instruction (ldtlb)................................................................................. 66 3.4.4 avoiding synonym problems .............................................................................. 67 3.5 mmu exceptions.............................................................................................................. 6 9 3.5.1 tlb miss exception............................................................................................ 69 3.5.2 tlb protection violation exception ................................................................... 70 3.5.3 tlb invalid exception ........................................................................................ 71 3.5.4 initial page write exception................................................................................ 72 3.5.5 processing flow in event of mmu exception (same processing flow for cpu address error)................................................. 74 3.6 configuration of the memory-mapped tlb .................................................................... 76 3.6.1 address array...................................................................................................... 76 3.6.2 data array............................................................................................................ 76 3.6.3 usage examples................................................................................................... 78 3.7 usage note................................................................................................................... ..... 78 3.7.1 use of instructions manipulating md and bl bits in sr ................................... 78 3.7.2 use of tlb .......................................................................................................... 79 section 4 exception processing......................................................................... 81 4.1 exception processing function......................................................................................... 81 4.1.1 exception processing flow.................................................................................. 81 4.1.2 exception processing vector addresses.............................................................. 82 4.1.3 acceptance of exceptions.................................................................................... 83 4.1.4 exception codes .................................................................................................. 85 4.1.5 exception request and bl bit............................................................................. 86 4.1.6 returning from exception processing ................................................................. 86 4.2 register description......................................................................................................... .87 4.2.1 exception event register (expevt).................................................................. 87 4.2.2 interrupt event register (intevt)..................................................................... 87 4.2.3 interrupt event register 2 (intevt2)................................................................ 88 4.2.4 trapa exception register (tra) ..................................................................... 88 4.3 operation ................................................................................................................... ....... 89 4.3.1 reset .................................................................................................................... 8 9 4.3.2 interrupts.............................................................................................................. 89 4.3.3 general exceptions .............................................................................................. 90 4.4 individual exception operations....................................................................................... 90 4.4.1 resets................................................................................................................... 9 0 4.4.2 general exceptions .............................................................................................. 91 4.4.3 interrupts.............................................................................................................. 94 4.5 usage note................................................................................................................... ..... 96
rev. 4.00, 03/04, page xxiii of xlvi section 5 cache................................................................................................. 99 5.1 feature..................................................................................................................... .......... 99 5.1.1 cache structure.................................................................................................... 99 5.2 register description......................................................................................................... . 101 5.2.1 cache control register (ccr) ............................................................................ 101 5.2.2 cache control register 2 (ccr2)........................................................................ 102 5.3 operation................................................................................................................... ........ 104 5.3.1 searching the cache............................................................................................. 104 5.3.2 read access ......................................................................................................... 105 5.3.3 prefetch operation ............................................................................................... 106 5.3.4 write access ........................................................................................................ 106 5.3.5 write-back buffer ............................................................................................... 106 5.3.6 coherency of cache and external memory ......................................................... 107 5.4 memory-mapped cache.................................................................................................... 107 5.4.1 address array ...................................................................................................... 107 5.4.2 data array............................................................................................................ 108 5.4.3 usage examples................................................................................................... 110 section 6 interrupt controller (intc) .............................................................. 111 6.1 feature..................................................................................................................... .......... 111 6.2 input/output pin............................................................................................................. ... 113 6.3 interrupt sources ............................................................................................................ ... 113 6.3.1 nmi interrupts ..................................................................................................... 113 6.3.2 irq interrupt........................................................................................................ 114 6.3.3 irl interrupts....................................................................................................... 115 6.3.4 on-chip peripheral module interrupts ................................................................ 116 6.3.5 interrupt exception processing and priority ........................................................ 117 6.4 register description......................................................................................................... . 121 6.4.1 interrupt priority registers a to e (ipra to ipre)............................................. 121 6.4.2 interrupt control register 0 (icr0)..................................................................... 122 6.4.3 interrupt control register 1 (icr1)..................................................................... 123 6.4.4 interrupt request register 0 (irr0) .................................................................... 125 6.4.5 interrupt request register 1 (irr1) .................................................................... 127 6.4.6 interrupt request register 2 (irr2) .................................................................... 128 6.5 operation................................................................................................................... ........ 129 6.5.1 interrupt sequence ............................................................................................... 129 6.5.2 multiple interrupts ............................................................................................... 131 6.6 interrupt response time ................................................................................................... 132 section 7 user break controller ....................................................................... 135 7.1 feature..................................................................................................................... .......... 135 7.2 register description......................................................................................................... . 137 7.2.1 break address register a (bara) ..................................................................... 137
rev. 4.00, 03/04, page xxiv of xlvi 7.2.2 break address mask register a (bamra)........................................................ 138 7.2.3 break bus cycle register a (bbra).................................................................. 138 7.2.4 break address register b (barb) ..................................................................... 139 7.2.5 break address mask register b (bamrb) ........................................................ 140 7.2.6 break data register b (bdrb)........................................................................... 140 7.2.7 break data mask register b (bdmrb).............................................................. 140 7.2.8 break bus cycle register b (bbrb) .................................................................. 141 7.2.9 break control register (brcr) .......................................................................... 142 7.2.10 execution times break register (betr)............................................................ 145 7.2.11 branch source register (brsr).......................................................................... 146 7.2.12 branch destination register (brdr).................................................................. 147 7.2.13 break asid register a (basra)....................................................................... 147 7.2.14 break asid register b (basrb) ....................................................................... 148 7.3 operation ................................................................................................................... ....... 148 7.3.1 flow of the user break operation ....................................................................... 148 7.3.2 break on instruction fetch cycle......................................................................... 149 7.3.3 break by data access cycle................................................................................ 149 7.3.4 sequential break .................................................................................................. 150 7.3.5 value of saved program counter ........................................................................ 150 7.3.6 pc trace .............................................................................................................. 151 7.3.7 usage examples................................................................................................... 153 7.4 usage note................................................................................................................... ..... 156 section 8 bus state controller (bsc) ...............................................................159 8.1 feature ..................................................................................................................... ......... 159 8.2 input/output pin............................................................................................................. ... 161 8.3 area overview ................................................................................................................ .. 162 8.3.1 pcmcia support ................................................................................................ 165 8.4 register description......................................................................................................... . 169 8.4.1 bus control register 1 (bcr1) ........................................................................... 169 8.4.2 bus control register 2 (bcr2) ........................................................................... 172 8.4.3 wait state control register 1 (wcr1)................................................................ 174 8.4.4 wait state control register 2 (wcr2)................................................................ 177 8.4.5 individual memory control register (mcr) ...................................................... 180 8.4.6 pcmcia control register (pcr)........................................................................ 185 8.4.7 synchronous dram mode register (sdmr) .................................................... 188 8.4.8 refresh timer control/status register (rtcsr)................................................ 188 8.4.9 refresh timer counter (rtcnt)........................................................................ 191 8.4.10 refresh time constant register (rtcor) ......................................................... 191 8.4.11 refresh count register (rfcr) .......................................................................... 192 8.5 operation ................................................................................................................... ....... 192 8.5.1 endian/access size and data alignment............................................................. 192 8.5.2 description of areas ............................................................................................ 197
rev. 4.00, 03/04, page xxv of xlvi 8.5.3 basic interface ..................................................................................................... 200 8.5.4 synchronous dram interface............................................................................. 205 8.5.5 burst rom interface............................................................................................ 227 8.5.6 pcmcia interface ............................................................................................... 229 8.5.7 waits between access cycles.............................................................................. 239 8.5.8 bus arbitration..................................................................................................... 240 8.5.9 bus pull-up.......................................................................................................... 240 section 9 direct memory access controller (dmac) .................................... 243 9.1 feature..................................................................................................................... .......... 243 9.2 input/output pin............................................................................................................. ... 245 9.3 register description......................................................................................................... . 245 9.3.1 dma source address registers 0 to 3 (sar_0 to sar_3) ................................ 246 9.3.2 dma destination address registers 0 to 3 (dar_0 to dar_3)........................ 246 9.3.3 dma transfer count registers 0 to 3 (dmatcr_0 to dmatcr_3)............... 247 9.3.4 dma channel control registers 0 to 3 (chcr_0 to chcr_3)......................... 247 9.3.5 dma operation register (dmaor)................................................................... 253 9.4 operation................................................................................................................... ........ 255 9.4.1 dma transfer flow............................................................................................. 255 9.4.2 dma transfer requests ...................................................................................... 257 9.4.3 channel priority................................................................................................... 259 9.4.4 dma transfer types ........................................................................................... 262 9.4.5 number of bus cycle states and dreq pin sampling timing .......................... 274 9.4.6 source address reload function ......................................................................... 278 9.4.7 dma transfer ending conditions....................................................................... 280 9.5 compare match timer (cmt).......................................................................................... 282 9.5.1 feature ................................................................................................................. 28 2 9.5.2 register description............................................................................................. 283 9.5.3 operation ............................................................................................................. 285 9.6 examples of use ............................................................................................................... 287 9.6.1 example of dma transfer between a/d converter and external memory (address reload on) ............................................................................................ 287 9.6.2 example of dma transfer between external memory and scif transmitter (indirect address on) ........................................................................................... 288 9.7 cautions .................................................................................................................... ........ 290 section 10 clock pulse generator (cpg)......................................................... 291 10.1 feature.................................................................................................................... ........... 291 10.2 input/output pin............................................................................................................ .... 294 10.3 clock operating modes .................................................................................................... 294 10.4 register description........................................................................................................ .. 298 10.4.1 frequency control register (frqcr)................................................................. 298 10.5 operation.................................................................................................................. ......... 300
rev. 4.00, 03/04, page xxvi of xlvi 10.5.1 changing the multiplication rate ........................................................................ 300 10.5.2 changing the division ratio................................................................................ 300 10.6 usage note.................................................................................................................. ...... 301 section 11 watchdog timer (wdt) .................................................................303 11.1 feature .................................................................................................................... .......... 303 11.2 register description........................................................................................................ .. 304 11.2.1 watchdog timer counter (wtcnt)................................................................... 304 11.2.2 watchdog timer control/status register (wtcsr)........................................... 304 11.2.3 notes on register access..................................................................................... 306 11.3 operation .................................................................................................................. ........ 307 11.3.1 canceling software standbys .............................................................................. 307 11.3.2 changing the frequency ...................................................................................... 307 11.3.3 using watchdog timer mode ............................................................................. 308 11.3.4 using interval timer mode ................................................................................. 308 section 12 timer unit (tmu)...........................................................................309 12.1 feature .................................................................................................................... .......... 309 12.2 input/output pin............................................................................................................ .... 311 12.3 register description........................................................................................................ .. 311 12.3.1 timer output control register (tocr) .............................................................. 312 12.3.2 timer start register (tstr) ............................................................................... 313 12.3.3 timer control registers 0 to 2 (tcr_0 to tcr_2) ............................................ 314 12.3.4 timer constant registers 0 to 2 (tcor_0 to tcor_2)..................................... 317 12.3.5 timer counters 0 to 2 (tcnt_0 to tcnt_2)..................................................... 318 12.3.6 input capture register 2 (tcpr_2) .................................................................... 318 12.4 operation .................................................................................................................. ........ 319 12.4.1 counter operation................................................................................................ 319 12.4.2 input capture function ........................................................................................ 322 12.5 interrupts................................................................................................................. .......... 323 12.5.1 status flag set timing......................................................................................... 323 12.5.2 status flag clear timing ..................................................................................... 323 12.5.3 interrupt sources and priorities ........................................................................... 324 12.6 usage note.................................................................................................................. ...... 324 12.6.1 writing to registers ............................................................................................. 324 12.6.2 reading registers ................................................................................................ 324 section 13 realtime clock (rtc).....................................................................325 13.1 feature .................................................................................................................... .......... 325 13.2 input/output pin............................................................................................................ .... 327 13.3 register description........................................................................................................ .. 327 13.3.1 64-hz counter (r64cnt) ................................................................................... 328 13.3.2 second counter (rseccnt) .............................................................................. 328
rev. 4.00, 03/04, page xxvii of xlvi 13.3.3 minute counter (rmincnt) .............................................................................. 329 13.3.4 hour counter (rhrcnt).................................................................................... 329 13.3.5 day of the week counter (rwkcnt)................................................................ 330 13.3.6 date counter (rdaycnt) ................................................................................. 331 13.3.7 month counter (rmoncnt) ............................................................................. 331 13.3.8 year counter (ryrcnt) .................................................................................... 332 13.3.9 second alarm register (rsecar) ..................................................................... 332 13.3.10 minute alarm register (rminar) ..................................................................... 333 13.3.11 hour alarm register (rhrar)........................................................................... 334 13.3.12 day of the week alarm register (rwkar)....................................................... 335 13.3.13 date alarm register (rdayar) ........................................................................ 336 13.3.14 month alarm register (rmonar) .................................................................... 337 13.3.15 rtc control register 1 (rcr1).......................................................................... 338 13.3.16 rtc control register 2 (rcr2).......................................................................... 339 13.4 rtc operation............................................................................................................... ... 341 13.4.1 initial settings of registers after power-on ........................................................ 341 13.4.2 setting the time................................................................................................... 341 13.4.3 reading the time................................................................................................. 342 13.4.4 alarm function .................................................................................................... 343 13.4.5 crystal oscillator circuit ..................................................................................... 344 13.5 usage note.................................................................................................................. ...... 345 13.5.1 register writing during rtc count .................................................................... 345 13.5.2 use of realtime clock (rtc) periodic interrupts ............................................... 345 13.5.3 timing for setting adj bit in rcr2................................................................... 346 section 14 serial communication interface (sci) ........................................... 347 14.1 feature.................................................................................................................... ........... 347 14.2 input/output pin............................................................................................................ .... 351 14.3 register description........................................................................................................ .. 351 14.3.1 receive shift register (scrsr).......................................................................... 352 14.3.2 receive data register (scrdr) ......................................................................... 352 14.3.3 transmit shift register (sctsr) ........................................................................ 352 14.3.4 transmit data register (sctdr)........................................................................ 352 14.3.5 serial mode register (scsmr)........................................................................... 353 14.3.6 serial control register (scscr)......................................................................... 355 14.3.7 serial status register (scssr)............................................................................ 359 14.3.8 sc port control register (scpcr)...................................................................... 364 14.3.9 sc port data register (scpdr) .......................................................................... 365 14.3.10 bit rate register (scbrr).................................................................................. 366 14.4 operation.................................................................................................................. ......... 372 14.4.1 operation in asynchronous mode ....................................................................... 374 14.4.2 multiprocessor communication........................................................................... 382 14.4.3 clock synchronous operation ............................................................................. 389
rev. 4.00, 03/04, page xxviii of xlvi 14.5 sci interrupt sources........................................................................................................ 396 14.6 usage note.................................................................................................................. ...... 397 section 15 smart card interface........................................................................401 15.1 feature .................................................................................................................... .......... 401 15.2 input/output pin............................................................................................................ .... 402 15.3 register description........................................................................................................ .. 402 15.3.1 smart card mode register (scscmr) ............................................................... 403 15.3.2 serial status register (scssr)............................................................................ 404 15.4 operation .................................................................................................................. ........ 406 15.4.1 overview.............................................................................................................. 406 15.4.2 pin connections ................................................................................................... 406 15.4.3 data format ......................................................................................................... 407 15.4.4 register settings .................................................................................................. 408 15.4.5 clock.................................................................................................................... 410 15.4.6 data transmission and reception........................................................................ 412 15.5 usage note.................................................................................................................. ...... 416 section 16 serial communication interface with fifo (scif) ........................421 16.1 feature .................................................................................................................... .......... 421 16.2 input/output pin............................................................................................................ .... 425 16.3 register description........................................................................................................ .. 425 16.3.1 receive shift register 2 (scrsr2)..................................................................... 426 16.3.2 receive fifo data register 2 (scfrdr2) ........................................................ 426 16.3.3 transmit shift register 2 (sctsr2) ................................................................... 426 16.3.4 transmit fifo data register 2 (scftdr2) ....................................................... 426 16.3.5 serial mode register 2 (scsmr2)...................................................................... 426 16.3.6 serial control register 2 (scscr2).................................................................... 429 16.3.7 serial status register 2 (scssr2)....................................................................... 431 16.3.8 bit rate register 2 (scbrr2) ............................................................................ 439 16.3.9 fifo control register 2 (scfcr2) .................................................................... 443 16.3.10 fifo data count set register 2 (scfdr2) ........................................................ 445 16.3.11 sc port control register (scpcr) ..................................................................... 445 16.3.12 sc port data register (scpdr).......................................................................... 445 16.4 operation .................................................................................................................. ........ 446 16.4.1 serial operation ................................................................................................... 447 16.4.2 scif interrupts .................................................................................................... 456 16.5 usage notes ................................................................................................................. ..... 457 section 17 pin function controller (pfc) ........................................................459 17.1 register description........................................................................................................ .. 462 17.1.1 port a control register (pacr) ......................................................................... 463 17.1.2 port b control register (pbcr).......................................................................... 464
rev. 4.00, 03/04, page xxix of xlvi 17.1.3 port c control register (pccr) .......................................................................... 466 17.1.4 port d control register (pdcr).......................................................................... 467 17.1.5 port e control register (pecr) .......................................................................... 469 17.1.6 port f control register (pfcr)........................................................................... 470 17.1.7 port g control register (pgcr).......................................................................... 472 17.1.8 port h control register (phcr).......................................................................... 473 17.1.9 port j control register (pjcr) ............................................................................ 475 17.1.10 sc port control register (scpcr)...................................................................... 476 section 18 i/o ports .......................................................................................... 479 18.1 port a...................................................................................................................... .......... 479 18.1.1 register description............................................................................................. 479 18.1.2 port a data register (padr).............................................................................. 479 18.2 port b ...................................................................................................................... .......... 480 18.2.1 register description............................................................................................. 481 18.2.2 port b data register (pbdr) .............................................................................. 481 18.3 port c ...................................................................................................................... .......... 482 18.3.1 register description............................................................................................. 482 18.3.2 port c data register (pcdr) .............................................................................. 482 18.4 port d...................................................................................................................... .......... 483 18.4.1 register description............................................................................................. 484 18.4.2 port d data register (pddr).............................................................................. 484 18.5 port e ...................................................................................................................... .......... 485 18.5.1 register description............................................................................................. 485 18.5.2 port e data register (pedr)............................................................................... 485 18.6 port f...................................................................................................................... ........... 486 18.6.1 register description............................................................................................. 487 18.6.2 port f data register (pfdr) ............................................................................... 487 18.7 port g...................................................................................................................... .......... 488 18.7.1 register description............................................................................................. 488 18.7.2 port g data register (pgdr).............................................................................. 488 18.8 port h...................................................................................................................... .......... 489 18.8.1 register description............................................................................................. 490 18.8.2 port h data register (phdr).............................................................................. 490 18.9 port j ...................................................................................................................... ........... 491 18.9.1 register description............................................................................................. 491 18.9.2 port j data register (pjdr)................................................................................. 492 18.10 sc port.................................................................................................................... .......... 493 18.10.1 register description............................................................................................. 493 18.10.2 sc port data register (scpdr) .......................................................................... 493 section 19 a/d converter (adc)..................................................................... 495 19.1 features ................................................................................................................... .......... 495
rev. 4.00, 03/04, page xxx of xlvi 19.2 input/output pin............................................................................................................ .... 497 19.3 register description........................................................................................................ .. 497 19.3.1 a/d data registers a to d (addra to addrd) ............................................. 498 19.3.2 a/d control/status register (adcsr) ............................................................... 499 19.3.3 a/d control register (adcr) ............................................................................ 501 19.4 bus master interface ......................................................................................................... 501 19.5 access size of a/d data register .................................................................................... 503 19.5.1 word access ........................................................................................................ 503 19.5.2 longword access ................................................................................................ 503 19.6 operation .................................................................................................................. ........ 503 19.6.1 single mode (multi = 0) .................................................................................. 503 19.6.2 multi mode (multi = 1, scn = 0).................................................................... 505 19.6.3 scan mode (multi = 1, scn = 1)..................................................................... 506 19.6.4 input sampling and a/d conversion time ......................................................... 508 19.6.5 external trigger input timing............................................................................. 509 19.7 interrupt requests .......................................................................................................... ... 509 19.8 definitions of a/d conversion accuracy......................................................................... 510 19.9 usage note.................................................................................................................. ...... 511 19.9.1 setting analog input voltage .............................................................................. 511 19.9.2 processing of analog input pins.......................................................................... 511 19.9.3 access size and read data.................................................................................. 512 section 20 d/a converter (dac) .....................................................................513 20.1 feature .................................................................................................................... .......... 513 20.2 input/output pin............................................................................................................ .... 514 20.3 register description........................................................................................................ .. 514 20.3.1 d/a data registers 0 and 1 (dadr0 and dadr1)............................................ 514 20.3.2 d/a control register (dacr) ............................................................................ 515 20.4 operation .................................................................................................................. ........ 516 section 21 user debugging interface (h-udi).................................................517 21.1 feature .................................................................................................................... .......... 518 21.2 input/output pin............................................................................................................ .... 518 21.3 register description........................................................................................................ .. 519 21.3.1 bypass register (sdbpr) ................................................................................... 519 21.3.2 instruction register (sdir) ................................................................................. 519 21.3.3 boundary scan register (sdbsr) ...................................................................... 520 21.4 h-udi operations............................................................................................................ . 525 21.4.1 tap controller .................................................................................................... 525 21.4.2 reset configuration ............................................................................................. 526 21.4.3 h-udi reset ........................................................................................................ 527 21.4.4 h-udi interrupt ................................................................................................... 527 21.4.5 bypass.................................................................................................................. 5 27
rev. 4.00, 03/04, page xxxi of xlvi 21.4.6 using h-udi to recover from sleep mode........................................................ 527 21.5 boundary scan ............................................................................................................... ... 528 21.5.1 supported instructions ......................................................................................... 528 21.5.2 notes for boundary scan ..................................................................................... 529 21.6 usage note.................................................................................................................. ...... 529 21.7 advanced user debugger (aud) ..................................................................................... 529 section 22 power-down modes ....................................................................... 531 22.1 input/output pin............................................................................................................ .... 532 22.2 register description........................................................................................................ .. 532 22.2.1 standby control register (stbcr)..................................................................... 532 22.2.2 standby control register 2 (stbcr2)................................................................ 534 22.3 operation.................................................................................................................. ......... 535 22.3.1 sleep mode .......................................................................................................... 535 22.3.2 software standby mode....................................................................................... 536 22.3.3 module standby function.................................................................................... 539 22.3.4 timing of status pin changes ........................................................................ 540 22.3.5 hardware standby function................................................................................. 544 section 23 list of registers .............................................................................. 547 23.1 register address map....................................................................................................... 54 7 23.2 register bits............................................................................................................... ....... 553 23.3 register states in processing mode .................................................................................. 564 section 24 electrical characteristics ................................................................ 569 24.1 absolute maximum ratings ............................................................................................. 569 24.2 dc characteristics .......................................................................................................... .. 571 24.3 ac characteristics .......................................................................................................... .. 574 24.3.1 clock timing ....................................................................................................... 574 24.3.2 control signal timing ......................................................................................... 580 24.3.3 ac bus timing.................................................................................................... 583 24.3.4 basic timing........................................................................................................ 585 24.3.5 burst rom timing .............................................................................................. 588 24.3.6 synchronous dram timing ............................................................................... 591 24.3.7 pcmcia timing ................................................................................................. 608 24.3.8 peripheral module signal timing........................................................................ 615 24.3.9 h-udi, aud related pin timing ....................................................................... 618 24.3.10 a/d converter timing......................................................................................... 620 24.3.11 ac characteristics measurement conditions ...................................................... 622 24.3.12 delay time variation due to load capacitance ................................................. 623 24.4 a/d converter characteristics .......................................................................................... 624 24.5 d/a converter characteristics .......................................................................................... 624
rev. 4.00, 03/04, page xxxii of xlvi appendix .........................................................................................................625 a. equivalent circuits of i/o buffer for each pin................................................................. 625 b. pin functions ................................................................................................................. ... 629 b.1 pin functions ....................................................................................................... 629 b.2 pin specifications ................................................................................................ 633 b.3 processing of unused pins................................................................................... 637 b.4 pin states in access to each address space........................................................ 638 c. product lineup................................................................................................................ .. 653 d. package dimensions ......................................................................................................... 654 index .........................................................................................................657
rev. 4.00, 03/04, page xxxiii of xlvi figures section 1 overview figure 1.1 sh7706 block diagram ................................................................................................3 figure 1.2 pin assignment (fp-176c)............................................................................................4 figure 1.3 pin assignment (tbp-208a).........................................................................................5 section 2 cpu figure 2.1 register configuration ................................................................................................1 4 figure 2.2 general registers...................................................................................................... ...15 figure 2.3 system registers ....................................................................................................... ..16 figure 2.4 control registers ...................................................................................................... ...17 figure 2.5 data format in memory ..............................................................................................21 figure 2.6 processor state transitions..........................................................................................49 section 3 memory management unit (mmu) figure 3.1 mmu functions .......................................................................................................... 52 figure 3.2 virtual address space mapping..................................................................................54 figure 3.3 overall configuration of the tlb ...............................................................................59 figure 3.4 virtual address and tlb structure.............................................................................60 figure 3.5 tlb indexing (ix = 1) ................................................................................................61 figure 3.6 tlb indexing (ix = 0) ................................................................................................61 figure 3.7 objects of address comparison ..................................................................................63 figure 3.8 operation of ldtlb instruction.................................................................................66 figure 3.9 synonym problem .......................................................................................................6 8 figure 3.10 mmu exception generation flowchart ....................................................................73 figure 3.11 mmu exception signals in instruction fetch ...........................................................74 figure 3.12 mmu exception signals in data access ..................................................................75 figure 3.13 specifying address and data for memory-mapped tlb access .............................77 section 4 exception processing figure 4.1 vector addresses....................................................................................................... ..82 figure 4.2 example of acceptance order of general exceptions ................................................84 section 5 cache figure 5.1 cache structure ........................................................................................................ ...99 figure 5.2 cache search scheme (normal mode)......................................................................105 figure 5.3 write-back buffer configuration..............................................................................106 figure 5.4 specifying address and data for memory-mapped cache access...........................109 section 6 interrupt controller (intc) figure 6.1 intc block diagram ................................................................................................112 figure 6.2 example of irl interrupt connection.......................................................................115 figure 6.3 interrupt operation flowchart ...................................................................................130
rev. 4.00, 03/04, page xxxiv of xlvi figure 6.4 example of pipeline operations when irl interrupt is accepted ............................ 134 section 7 user break controller figure 7.1 block diagram of user break controller.................................................................. 136 section 8 bus state controller (bsc) figure 8.1 bsc functional block diagram................................................................................ 160 figure 8.2 corresponding to logical address space and physical address space.................... 163 figure 8.3 physical space allocation ......................................................................................... 164 figure 8.4 pcmcia space allocation ....................................................................................... 166 figure 8.5 basic timing of basic interface ................................................................................ 200 figure 8.6 example of 32-bit data-width static ram connection .......................................... 201 figure 8.7 example of 16-bit data-width static ram connection .......................................... 202 figure 8.8 example of 8-bit data-width static ram connection ............................................ 202 figure 8.9 basic interface wait timing (software wait only).................................................. 203 figure 8.10 basic interface wait state timing (wait state insertion by wait signal waitsel = 1).......................................... 204 figure 8.11 example of 64-mbit synchronous dram connection (32-bit bus width)........... 206 figure 8.12 example of 64-mbit synchronous dram (16-bit bus width).............................. 207 figure 8.13 basic timing for synchronous dram burst read ................................................ 210 figure 8.14 synchronous dram burst read wait specification timing ................................. 211 figure 8.15 basic timing for synchronous dram single read............................................... 212 figure 8.16 basic timing for synchronous dram burst write ............................................... 213 figure 8.17 basic timing for synchronous dram single write.............................................. 214 figure 8.18 burst read timing (no precharge) ......................................................................... 216 figure 8.19 burst read timing (same row address) ............................................................... 217 figure 8.20 burst read timing (different row addresses) ...................................................... 218 figure 8.21 burst write timing (no precharge) ........................................................................ 219 figure 8.22 burst write timing (same row address)............................................................... 220 figure 8.23 burst write timing (different row addresses) ..................................................... 221 figure 8.24 auto-refresh operation .......................................................................................... 222 figure 8.25 synchronous dram auto-refresh timing............................................................ 223 figure 8.26 synchronous dram self-refresh timing ............................................................. 224 figure 8.27 synchronous dram mode write timing .............................................................. 226 figure 8.28 burst rom wait access timing............................................................................. 228 figure 8.29 burst rom basic access timing ........................................................................... 229 figure 8.30 pcmcia space allocation ..................................................................................... 230 figure 8.31 example of pcmcia interface ............................................................................... 231 figure 8.32 basic timing for pcmcia memory card interface ............................................... 232 figure 8.33 wait timing for pcmcia memory card interface ................................................ 233 figure 8.34 basic timing for pcmcia memory card interface burst access ......................... 234 figure 8.35 wait timing for pcmcia memory card interface burst access .......................... 235 figure 8.36 basic timing for pcmcia i/o card interface ....................................................... 236 figure 8.37 wait timing for pcmcia i/o card interface ........................................................ 237
rev. 4.00, 03/04, page xxxv of xlvi figure 8.38 dynamic bus sizing timing for pcmcia i/o card interface ...............................238 figure 8.39 waits between access cycles .................................................................................239 figure 8.40 pins a25 to a0 pull-up timing ..............................................................................240 figure 8.41 pins d31 to d0 pull-up timing (read cycle) ........................................................241 figure 8.42 pins d31 to d0 pull-up timing (write cycle) .......................................................241 section 9 direct memory access controller (dmac) figure 9.1 dmac block diagram..............................................................................................244 figure 9.2 dmac transfer flowchart .......................................................................................256 figure 9.3 round-robin mode ...................................................................................................260 figure 9.4 changes in channel priority in round-robin mode.................................................261 figure 9.5 operation in the direct address mode in the dual address mode ...........................263 figure 9.6 example of dma transfer timing in the direct address mode in the dual address mode (transfer source: ordinary memory, transfer destination: ordinary memory) .................................................................264 figure 9.7 example of dma transfer timing in the direct address mode in the dual address mode (16-byte transfer, transfer source: ordinary memory, transfer destination: ordinary memory) ..................................265 figure 9.8 example of dma transfer timing in the direct address mode in the dual address mode (16-byte transfer, transfer source: synchronous dram, transfer destination: ordinary memory)..............................265 figure 9.9 operation in the indirect address mode in the dual address mode (when the external memory space has a 16-bit width) ..........................................267 figure 9.10 example of transfer timing in the indirect address mode in the dual address mode.......................................................................................268 figure 9.11 data flow in the single address mode...................................................................269 figure 9.12 example of dma transfer timing in the single address mode............................270 figure 9.13 example of dma transfer timing in the single address mode (16- byte transfer, external memory space (ordinary memory) -> external device with dack) .................................................................................271 figure 9.14 dma transfer example in the cycle-steal mode ..................................................271 figure 9.15 dma transfer example in the burst mode ............................................................272 figure 9.16 bus state when multiple channels are operating (priority level is round-robin mode) ......................................................................274 figure 9.17 cycle-steal mode, level input (cpu access: 2 cycles) ........................................276 figure 9.18 cycle-steal mode, level input (cpu access: 3 cycles) ........................................276 figure 9.19 cycle-steal mode, level input (cpu access: 2 cycles, dma rd access: 4 cycles) ..................................................................................................................276 figure 9.20 cycle-steal mode, level input (cpu access: 2 cycles, dreq input delayed) ....277 figure 9.21 cycle-steal mode, edge input (cpu access: 2 cycles) .........................................277 figure 9.22 burst mode, level input..........................................................................................277 figure 9.23 burst mode, edge input ..........................................................................................278 figure 9.24 source address reload function diagram..............................................................278
rev. 4.00, 03/04, page xxxvi of xlvi figure 9.25 timing chart of source address reload function.................................................. 279 figure 9.26 cmt block diagram............................................................................................... 282 figure 9.27 counter operation ................................................................................................... 28 5 figure 9.28 count timing .......................................................................................................... 285 figure 9.29 cmf set timing...................................................................................................... 286 figure 9.30 timing of cmf clear by the cpu .......................................................................... 286 section 10 clock pulse generator (cpg) figure 10.1 block diagram of clock pulse generator ............................................................... 292 figure 10.2 points for attention when using crystal oscillator ................................................ 301 figure 10.3 points for attention when using pll oscillator circuit ........................................ 302 section 11 watchdog timer (wdt) figure 11.1 block diagram of the wdt .................................................................................... 303 figure 11.2 writing to wtcnt and wtcsr............................................................................ 306 section 12 timer unit(tmu) figure 12.1 tmu block diagram............................................................................................... 310 figure 12.2 setting the count operation .................................................................................... 319 figure 12.3 auto-reload count operation................................................................................. 320 figure 12.4 count timing when internal clock is operating .................................................... 320 figure 12.5 count timing when external clock is operating (both edges detected) .............. 321 figure 12.6 count timing when on-chip rtc clock is operating .......................................... 321 figure 12.7 operation timing when using the input capture function (using tclk rising edge) ..................................................................................... 322 figure 12.8 unf set timing ...................................................................................................... 323 figure 12.9 status flag clear timing......................................................................................... 323 section 13 realtime clock (rtc) figure 13.1 rtc block diagram................................................................................................ 326 figure 13.2 setting the time ...................................................................................................... 3 41 figure 13.3 reading the time .................................................................................................... 342 figure 13.4 using the alarm function ....................................................................................... 343 figure 13.5 example of crystal oscillator circuit connection.................................................. 344 figure 13.6 using periodic interrupt function ........................................................................... 345 section 14 serial communication interface (sci) figure 14.1 sci block diagram ................................................................................................. 348 figure 14.2 scpt[1]/sck0 pin.................................................................................................. 349 figure 14.3 scpt[0]/txd0 pin.................................................................................................. 350 figure 14.4 scpt[0]/rxd0 pin.................................................................................................. 350 figure 14.5 data format in asynchronous communication ...................................................... 374 figure 14.6 output clock and serial data timing (asynchronous mode) ................................ 376 figure 14.7 sample flowchart for sci initialization.................................................................. 376 figure 14.8 sample flowchart for transmitting serial data ...................................................... 377 figure 14.9 sci transmit operation in asynchronous mode .................................................... 378
rev. 4.00, 03/04, page xxxvii of xlvi figure 14.10 sample flowchart for receiving serial data ........................................................379 figure 14.11 sci receive operation ..........................................................................................382 figure 14.12 communication among processors using multiprocessor format ......................383 figure 14.13 sample flowchart for transmitting multiprocessor serial data ...........................384 figure 14.14 sci multiprocessor transmit operation................................................................385 figure 14.15 sample flowchart for receiving multiprocessor serial data ...............................386 figure 14.16 example of sci receive operation.......................................................................388 figure 14.17 data format in clock synchronous communication ............................................389 figure 14.18 sample flowchart for sci initialization................................................................390 figure 14.19 sample flowchart for serial transmitting.............................................................391 figure 14.20 example of sci transmit operation .....................................................................392 figure 14.21 sample flowchart for serial data receiving ........................................................393 figure 14.22 example of sci receive operation.......................................................................394 figure 14.23 sample flowchart for serial data transmitting/receiving...................................395 figure 14.24 receive data sampling timing in asynchronous mode ......................................398 section 15 smart card interface figure 15.1 smart card interface block diagram ......................................................................401 figure 15.2 pin connection diagram for the smart card interface............................................407 figure 15.3 data format for smart card interface .....................................................................407 figure 15.4 waveform of start character...................................................................................409 figure 15.5 initialization flowchart (example)..........................................................................413 figure 15.6 transmission flowchart ..........................................................................................414 figure 15.7 reception flowchart (example) ..............................................................................415 figure 15.8 receive data sampling timing in smart card mode .............................................417 figure 15.9 retransmission in sci receive mode .....................................................................418 figure 15.10 retransmission in sci transmit mode..................................................................419 section 16 serial communication interface with fifo (scif) figure 16.1 scif block diagram ...............................................................................................422 figure 16.2 scpt[3]/sck2 pin..................................................................................................423 figure 16.3 scpt[2]/txd2 pin ..................................................................................................424 figure 16.4 scpt[2]/rxd2 pin..................................................................................................424 figure 16.5 sample scif initialization flowchart .....................................................................449 figure 16.6 sample serial transmission flowchart ...................................................................450 figure 16.7 example of transmit operation (example with 8-bit data, parity, one stop bit) ..........................................................................................................452 figure 16.8 example of operation using modem control ( cts2 )............................................452 figure 16.9 sample serial reception flowchart (1)...................................................................453 figure 16.10 sample serial reception flowchart (2).................................................................454 figure 16.11 example of scif receive operation (example with 8-bit data, parity, one stop bit) ........................................................................................................455 figure 16.12 example of operation using modem control ( rts2 )..........................................455 figure 16.13 receive data sampling timing in asynchronous mode ......................................458
rev. 4.00, 03/04, page xxxviii of xlvi section 18 i/o ports figure 18.1 port a ................................................................................................................ ...... 479 figure 18.2 port b ................................................................................................................ ...... 480 figure 18.3 port c ................................................................................................................ ...... 482 figure 18.4 port d ................................................................................................................ ...... 483 figure 18.5 port e................................................................................................................ ....... 485 figure 18.6 port f................................................................................................................ ....... 486 figure 18.7 port g ................................................................................................................ ...... 488 figure 18.8 port h ................................................................................................................ ...... 489 figure 18.9 port j................................................................................................................ ........ 491 figure 18.10 sc port .............................................................................................................. .... 493 section 19 a/d converter (adc) figure 19.1 a/d converter block diagram................................................................................ 496 figure 19.2 a/d data register access operation (reading h'aa40) ....................................... 502 figure 19.3 word access example ............................................................................................ 503 figure 19.4 longword access example..................................................................................... 503 figure 19.5 example of a/d converter operation (single mode, channel 1 selected) ............ 504 figure 19.6 example of a/d converter operation (multi mode, channels an0 to an2 selected)...................................................... 506 figure 19.7 example of a/d converter operation (scan mode, channels an0 to an2 selected) ........................................................ 507 figure 19.8 a/d conversion timing.......................................................................................... 508 figure 19.9 external trigger input timing ................................................................................ 509 figure 19.10 definitions of a/d conversion accuracy ............................................................. 510 figure 19.11 example of analog input protection circuit ......................................................... 511 figure 19.12 analog input pin equivalent circuit ..................................................................... 511 section 20 d/a converter (dac) figure 20.1 d/a converter block diagram................................................................................ 513 figure 20.2 example of d/a converter operation..................................................................... 516 section 21 user debugging interface (h-udi) figure 21.1 h-udi block diagram ............................................................................................ 517 figure 21.2 tap controller state transitions ............................................................................ 525 figure 21.3 h-udi reset........................................................................................................... . 527 section 22 power-down modes figure 22.1 canceling software standby mode with stbcr.stby ........................................ 537 figure 22.2 power-on reset status output........................................................................... 540 figure 22.3 manual reset status output............................................................................... 540 figure 22.4 software standby to interrupt status output ..................................................... 541 figure 22.5 software standby to power-on reset status output ......................................... 541 figure 22.6 software standby to manual reset status output ............................................. 542 figure 22.7 sleep to interrupt status output ......................................................................... 542
rev. 4.00, 03/04, page xxxix of xlvi figure 22.8 sleep to power-on reset status output.............................................................543 figure 22.9 sleep to manual reset status output .................................................................543 figure 22.10 hardware standby mode (when ca goes low in normal operation)...............545 figure 22.11 hardware standby mode timing (when ca goes low during wdt operation on standby mode cancellation)..546 power-on sequence............................................................................................................... .......570 section 24 electrical characteristics figure 24.1 extal clock input timing ...................................................................................576 figure 24.2 ckio clock input timing.......................................................................................576 figure 24.3 ckio clock output timing ....................................................................................576 figure 24.4 power-on oscillation settling time .......................................................................577 figure 24.5 oscillation settling time at standby return (return by reset)..............................577 figure 24.6 oscillation settling time at standby return (return by nmi) ...............................577 figure 24.7 oscillation settling time at standby return (return by irq or irl) ...................578 figure 24.8 pll synchronization settling time by reset or nmi at the returning from standby mode (return by reset or nmi).....................578 figure 24.9 pll synchronization settling time at the returning from standby mode (return by irq/irl interrupt).................................................................................579 figure 24.10 pll synchronization settling time when frequency multiplication rate modified .......................................................................................................579 figure 24.11 reset input timing ................................................................................................581 figure 24.12 interrupt signal input timing................................................................................581 figure 24.13 irqout timing ...................................................................................................581 figure 24.14 bus release timing...............................................................................................582 figure 24.15 pin drive timing at standby .................................................................................582 figure 24.16 basic bus cycle (no wait) ...................................................................................585 figure 24.17 basic bus cycle (one wait)..................................................................................586 figure 24.18 basic bus cycle (external wait)...........................................................................587 figure 24.19 burst rom bus cycle (no wait)..........................................................................588 figure 24.20 burst rom bus cycle (two waits)......................................................................589 figure 24.21 burst rom bus cycle (external wait) .................................................................590 figure 24.22 synchronous dram read bus cycle (rcd = 0, cas latency = 1, tpc = 0)....591 figure 24.23 synchronous dram read bus cycle (rcd = 2, cas latency = 2, tpc = 1)....592 figure 24.24 synchronous dram read bus cycle (burst read (single read 4), rcd = 0, cas latency = 1, tpc = 1)...................................................................593 figure 24.25 synchronous dram read bus cycle (burst read (single read 4), rcd = 1, cas latency = 3, tpc = 0)...................................................................594 figure 24.26 synchronous dram write bus cycle (rcd = 0, tpc = 0, trwl = 0) .............595 figure 24.27 synchronous dram write bus cycle (rcd = 2, tpc = 1, trwl = 1) .............596 figure 24.28 synchronous dram write bus cycle (burst mode (single write 4), rcd = 0, tpc = 1, trwl = 0).............................................................................597
rev. 4.00, 03/04, page xl of xlvi figure 24.29 synchronous dram write bus cycle (burst mode (single write 4), rcd = 1, tpc = 0, trwl = 0) ............................................................................. 598 figure 24.30 synchronous dram burst read bus cycle (ras down, same row address, cas latency = 1)........................................... 599 figure 24.31 synchronous dram burst read bus cycle (ras down, same row address, cas latency = 2)............................................ 600 figure 24.32 synchronous dram burst read bus cycle (ras down, different row address, tpc = 0, rcd = 0, cas latency = 1) ...... 601 figure 24.33 synchronous dram burst read bus cycle (ras down, different row address, tpc = 1, rcd = 0, cas latency = 1) ..... 602 figure 24.34 synchronous dram burst write bus cycle (ras down, same row address) ......................................................................... 603 figure 24.35 synchronous dram burst write bus cycle (ras down, different row address, tpc = 0, rcd = 0).................................... 604 figure 24.36 synchronous dram burst write bus cycle (ras down, different row address, tpc = 1, rcd = 1).................................... 605 figure 24.37 synchronous dram auto-refresh timing (tras = 1, tpc = 1) ...................... 606 figure 24.38 synchronous dram self-refresh cycle (tpc = 0)............................................. 606 figure 24.39 synchronous dram mode register write cycle ................................................ 607 figure 24.40 pcmcia memory bus cycle (ted = 0, teh = 0, no wait) .............................. 608 figure 24.41 pcmcia memory bus cycle (ted = 2, teh = 1, one wait, external wait).... 609 figure 24.42 pcmcia memory bus cycle (burst read, ted = 0, teh = 0, no wait).......... 610 figure 24.43 pcmcia memory bus cycle (burst read, ted = 1, teh = 1, two waits, burst pitch = 3)................................................................................... 611 figure 24.44 pcmcia i/o bus cycle (ted = 0, teh = 0, no wait)....................................... 612 figure 24.45 pcmcia i/o bus cycle (ted = 2, teh = 1, one wait, external wait) ............ 613 figure 24.46 pcmcia i/o bus cycle (ted = 1, teh = 1, one wait, bus sizing)................. 614 figure 24.47 tclk input timing .............................................................................................. 616 figure 24.48 tclk clock input timing.................................................................................... 616 figure 24.49 oscillation settling time at rtc crystal oscillator power-on............................. 616 figure 24.50 sck input clock timing....................................................................................... 616 figure 24.51 sci i/o timing in clock synchronous mode ....................................................... 617 figure 24.52 i/o port timing ..................................................................................................... 61 7 figure 24.53 dreq input timing.............................................................................................. 617 figure 24.54 drak output timing........................................................................................... 618 figure 24.55 tck input timing................................................................................................. 619 figure 24.56 trst input timing (reset hold).......................................................................... 619 figure 24.57 h-udi data transfer timing................................................................................ 619 figure 24.58 asemd0 input timing......................................................................................... 620 figure 24.59 aud timing.......................................................................................................... 6 20 figure 24.60 external trigger input timing .............................................................................. 621 figure 24.61 a/d conversion timing ........................................................................................ 621 figure 24.62 output load circuit............................................................................................... 622
rev. 4.00, 03/04, page xli of xlvi figure 24.63 load capacitance vs. delay time .........................................................................623 appendix figure d.1 package dimensions (fp-176c)...............................................................................654 figure d.2 package dimensions (tbp-208a)............................................................................655
rev. 4.00, 03/04, page xlii of xlvi tables section 2 cpu table 2.1 initial register values ................................................................................................ 15 table 2.2 addressing modes and effective addresses............................................................... 23 table 2.3 instruction formats ..................................................................................................... 27 table 2.4 classification of instructions ...................................................................................... 30 table 2.5 data transfer instructions........................................................................................... 34 table 2.6 arithmetic instructions ............................................................................................... 36 table 2.7 logic operation instructions ...................................................................................... 39 table 2.8 shift instructions...................................................................................................... ... 40 table 2.9 branch instructions ..................................................................................................... 41 table 2.10 system control instructions.................................................................................... 42 table 2.11 instruction code map ............................................................................................. 46 section 3 memory management unit (mmu) table 3.1 access states designated by d, c, and pr bits ......................................................... 64 section 4 exception processing table 4.1 exception event vectors............................................................................................. 82 table 4.2 exception codes ......................................................................................................... 85 table 4.3 types of reset ........................................................................................................... .91 section 5 cache table 5.1 lru and way replacement ..................................................................................... 100 table 5.2 way to be replaced when cache miss occurs during pref instruction execution................................................................................................ 103 table 5.3 way to be replaced when cache miss occurs during execution of instruction other than pref instruction ................................................................... 103 table 5.4 lru and way replacement (when w2lock=1) ................................................... 103 table 5.5 lru and way replacement (when w3lock=1) ................................................... 104 table 5.6 lru and way replacement (when w2lock=1 and w3lock=1)....................... 104 section 6 interrupt controller (intc) table 6.1 pin configuration...................................................................................................... 1 13 table 6.2 irl3 to irl0 pins and interrupt levels ................................................................... 115 table 6.3 interrupt exception handling sources and priority (irq mode) ............................. 117 table 6.4 interrupt exception handling sources and priority (irl mode).............................. 119 table 6.5 interrupt level and intevt code........................................................................... 120 table 6.6 interrupt request sources and ipra to ipre........................................................... 121 table 6.7 interrupt response time........................................................................................... 132 section 7 user break controller table 7.1 data access cycle addresses and operand size comparison conditions............... 149
rev. 4.00, 03/04, page xliii of xlvi section 8 bus state controller (bsc) table 8.1 pin configuration......................................................................................................1 61 table 8.2 physical address space map ....................................................................................163 table 8.3 correspondence between external pins (md4 and md3) and memory size...........165 table 8.4 pcmcia interface characteristics ...........................................................................166 table 8.5 pcmcia support interface ......................................................................................166 table 8.6 area 6 wait control..................................................................................................178 table 8.7 area 5 wait control..................................................................................................179 table 8.8 area 4 wait control..................................................................................................179 table 8.9 area 0 wait control..................................................................................................180 table 8.10 area 6 wait control..............................................................................................187 table 8.11 32-bit external device/big endian access and data alignment .........................193 table 8.12 16-bit external device/big endian access and data alignment .........................193 table 8.13 8-bit external device/big endian access and data alignment ...........................194 table 8.14 32-bit external device/little endian access and data alignment ......................195 table 8.15 16-bit external device/little endian access and data alignment ......................195 table 8.16 8-bit external device/little endian access and data alignment ........................196 table 8.17 relationship between bus width, amx, and address multiplex output ............208 table 8.18 example of correspondence between this lsi and synchronous dram address pins (amx (3 to 0) = 0100 (32-bit bus width))....................................209 section 9 direct memory access controller (dmac) table 9.1 pin configuration......................................................................................................2 45 table 9.2 selecting external request modes with the rs bits ................................................257 table 9.3 selecting on-chip peripheral module request modes with the rs bit...................258 table 9.4 supported dma transfers........................................................................................262 table 9.5 relationship of request modes and bus modes by dma transfer category .........272 table 9.6 transfer conditions and register settings for transfer between on-chip a/d converter and external memory ............................287 table 9.7 values in the dmac after the fourth transfer ends ...............................................288 table 9.8 transfer conditions and register settings for transfer between external memory and scif transmitter...................................................................289 section 10 clock pulse generator (cpg) table 10.1 clock pulse generator pins and functions ...........................................................294 table 10.2 clock operating modes ........................................................................................294 table 10.3 available combination of clock mode and frqcr values ...............................296 section 12 timer unit(tmu) table 12.1 pin configuration..................................................................................................311 table 12.2 tmu interrupt sources .........................................................................................324 section 13 realtime clock (rtc) table 13.1 rtc pin configuration .........................................................................................327 table 13.2 recommended oscillator circuit constants (recommended values)..................344
rev. 4.00, 03/04, page xliv of xlvi section 14 serial communication interface (sci) table 14.1 sci pins ............................................................................................................... . 351 table 14.2 scsmr settings ................................................................................................... 366 table 14.3 bit rates and scbrr settings in asynchronous mode ....................................... 367 table 14.4 bit rates and scbrr settings in clock synchronous mode............................... 369 table 14.5 maximum bit rates for various frequencies with baud rate generator synchronous mode)............................................................................................... 370 table 14.6 maximum bit rates during external clock input (asynchronous mode)............ 371 table 14.7 maximum bit rates during external clock input (clock synchronous mode) ... 371 table 14.8 serial mode register settings and sci communication formats ........................ 373 table 14.9 scsmr and scscr settings and sci clock source selection ........................... 373 table 14.10 serial communication formats (asynchronous mode)........................................ 375 table 14.11 receive error conditions and sci operation....................................................... 381 table 14.12 sci interrupt sources............................................................................................ 396 table 14.13 scssr status flags and transfer of receive data .............................................. 397 section 15 smart card interface table 15.1 pin configuration.................................................................................................. 402 table 15.2 register settings for the smart card interface...................................................... 408 table 15.3 relationship of n to cks1 and cks0................................................................... 410 table 15.4 examples of bit rate b (bit/s) for scbrr settings (n = 0) ................................ 410 table 15.5 examples of scbrr settings for bit rate b (bit/s) (n = 0) ................................ 411 table 15.6 maximum bit rates for frequencies (smart card interface mode) ..................... 411 table 15.7 register set values and sck pin ....................................................................... 412 table 15.8 smart card mode operating state and interrupt sources..................................... 416 section 16 serial communication interface with fifo (scif) table 16.1 scif pins .............................................................................................................. 425 table 16.2 scsmr2 settings ................................................................................................. 439 table 16.3 bit rates and scbrr2 settings ........................................................................... 440 table 16.4 maximum bit rates for various frequencies with baud rate generator (asynchronous mode)........................................................ 442 table 16.5 maximum bit rates during external clock input (asynchronous mode)............ 443 table 16.6 scsmr2 settings and scif communication formats......................................... 446 table 16.7 scscr2 and scscr2 settings and scif clock source selection...................... 447 table 16.8 serial communication formats ............................................................................ 447 table 16.9 scif interrupt sources ......................................................................................... 456 section 17 pin function controller (pfc) table 17.1 list of multiplexed pins........................................................................................ 459 section 18 i/o ports table 18.1 read/write operation of the port a data register (padr)................................. 480 table 18.2 read/write operation of the port b data register (pbdr) ................................ 481 table 18.3 read/write operation of the port c data register (pcdr) ................................. 483
rev. 4.00, 03/04, page xlv of xlvi table 18.4 read/write operation of the port d data register (pddr)................................484 table 18.5 read/write operation of the port e data register (pedr) .................................486 table 18.6 read/write operation of the port f data register (pfdr) ..................................487 table 18.7 read/write operation of the port g data register (pgdr).................................489 table 18.8 read/write operation of the port h data register (phdr).................................491 table 18.9 read/write operation of the port j data register (pjdr) ...................................492 table 18.10 read/write operation of the sc port data register (scpdr).............................494 section 19 a/d converter (adc) table 19.1 a/d converter pins...................................................................................................497 table 19.2 analog input channels and a/d data registers...................................................498 table 19.3 a/d conversion time (single mode)...................................................................509 table 19.4 analog input pin ratings......................................................................................512 table 19.5 relationship between access size and read data................................................512 section 20 d/a converter (dac) table 20.1 d/a converter pins...............................................................................................514 section 21 user debugging interface (h-udi) table 21.1 pin configuraiton..................................................................................................518 table 21.2 this lsi's pins and boundary scan register bits.................................................520 table 21.3 reset configuration ..............................................................................................526 section 22 power-down modes table 22.1 power-down modes .............................................................................................531 table 22.2 pin configuration..................................................................................................532 table 22.3 register states in software standby mode ...........................................................536 section 24 electrical characteristics table 24.1 absolute maximum ratings .................................................................................569 table 24.2 dc characteristics (ta = ?20 to 75c).................................................................571 table 24.3 permitted output current values (vccq = 3.3 0.3 v, vcc = 1.9 0.15 v, avcc = 3.3 0.3 v, ta = ?20 to 75c)................................................................573 table 24.4 operating frequency range..................................................................................574 table 24.5 clock timing ........................................................................................................574 table 24.6 control signal timing ..........................................................................................580 table 24.7 bus timing (clock modes 0/1/2/7) .....................................................................583 table 24.8 peripheral module signal timing.........................................................................615 table 24.9 h-udi, aud related pin timing ........................................................................618 table 24.10 a/d converter timing..........................................................................................620 table 24.11 a/d converter characteristics (vccq = 3.3 0.3 v, vcc = 1.9 0.15 v, avcc = 3.3 0.3 v, ta = ?20 to 75c)................................................................624 table 24.12 d/a converter characteristics (vccq = 3.3 0.3 v, vcc = 1.9 0.15 v, avcc = 3.3 0.3 v, ta = ?20 to 75c)................................................................624
rev. 4.00, 03/04, page xlvi of xlvi appendix table b.1 pin states during resets, power-down states, and bus-released state................... 629 table b.2 pin specifications ..................................................................................................... 6 33 table b.3 pin states (normal memory/little endian) .............................................................. 638 table b.4 pin states (normal memory/big endian)................................................................. 640 table b.5 pin states (burst rom/little endian) ...................................................................... 642 table b.6 pin states (burst rom/big endian) ......................................................................... 644 table b.7 pin states (synchronous dram/little endian) ....................................................... 646 table b.8 pin states (synchronous dram/big endian) .......................................................... 647 table b.9 pin states (pcmcia/little endian).......................................................................... 648 table b.10 pin states (pcmcia/big endian)......................................................................... 650
rev. 4.00, 03/04, page 1 of 660 section 1 overview the sh7706 is a risc microprocessor that integrates a renesas technology-original risc-type superh? architecture sh-3 cpu as its core that has peripheral functions required for system configuration. the cpu of this lsi has upper compatibility with the sh-1 and sh-2 at object code level. this lsi incorporates a memory management unit (mmu) that has a 128-entry 4-way set associative translation lookaside buffer (tlb). the lsi incorporates the following peripheral functions: an on-chip direct memory access controller (dmac) that enables high-speed data transfer and a bus state controller (bsc) that enables direct connection to different types of memory. the lsi also incorporates a serial communication interface, an a/d converter, a d/a converter, a timer, and a realtime clock that enable system configuration at low cost. a built-in power management function enables dynamic control of power consumption. thus, this lsi is optimum for portable electronic devices such as pdas that require both high performance and low power. the sh7706 incorporates a user deb ugging interface (h-udi) and an advanced user debugger (aud) to support emulator functions such as e10a. this lsi also incorporates a user break controller (ubc) for self debugging. note: * the superh is a trademark of renesas technology, corp. 1.1 feature ? original renesas superh architecture ? object code level compatible with sh-1, sh-2 and sh-3 ? 32-bit risc-type instruction set ? instruction length: 16-bit fixed length ? improved code efficiency ? load-store architecture ? delayed branch instructions ? instruction set oriented for c language ? five-stage pipeline ? instruction execution time: one instruction/cycle for basic instructions ? general-register: sixteen 32-bit general registers ? control-register: eight 32-bit control registers ? system-register: four 32-bit system registers ? 32-bit internal data bus ? logical address space: 4 gbytes
rev. 4.00, 03/04, page 2 of 660 ? space identifier asid: 8 bits, 256 logical address space ? abundant peripheral functions ? memory management unit (mmu) ? user break controller (ubc) ? bus state controller (bsc) ? direct memory access controller (dmac) ? clock pulse generator (cpg) ? watchdog timer (wdt) ? timer unit (tmu) ? realtime clock (rtc) ? serial communication interface (sci) ? smartcard interface ? serial communication interface with fifo (scif) ? 10-bit a/d converter (adc) ? 8-bit d/a converter (dac) ? user debugging interface (h-udi) ? advanced user debugger (aud)
rev. 4.00, 03/04, page 3 of 660 1.2 block diagram mmu tlb cpu ubc sci tmu rtc scif adc dac aud dmac cmt i/o port external bus interface bsc ccn cache h-udi intc cpg/wdt peripheral bus 1 peripheral bus 2 i bus 1 i bus 2 l bus legend adc aud bsc cache ccn cmt cpg/wdt cpu dac : a/d converter : advanced user debugger : bus state controller : cache memory : cache memory controller : compare match timer : clock pulse generator/watchdog timer : central processing unit : d/a converter dmac h-udi intc mmu rtc sci scif tlb tmu ubc : direct memory access controller : user debugging interface : interrupt controller : memory management unit : realtime clock : serial communication interface (with smart card interface) : serial communication interface (with fifo) : address translation buffer : timer unit : user break controller bridge figure 1.1 sh7706 block diagram
rev. 4.00, 03/04, page 4 of 660 1.3 pin assignment 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 v cc - rtc xtal2 extal2 v ss - rtc d31/ptb[7] d30/ptb[6] d29/ptb[5] d28/ptb[4] d27/ptb[3] d26/ptb[2] v ss q d25/ptb[1] v cc q d24/ptb[0] d23/pta[7] d22/pta[6] d21/pta[5] d20/pta[4] v ss d19/pta[3] v cc d18/pta[2] d17/pta[1] d16/pta[0] v ss q d15 v cc q d14 d13 d12 d11 d10 d9 d8 d7 d6 v ss q d5 v cc q d4 d3 d2 d1 d0 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 extal xtal v ss md1 v cc - pll2 cap2 v ss - pll2 v ss - pll1 cap1 v cc - pll1 /ptf[6] tdo/ptf[5] /ptg[3] tms/ptg[2] v cc tck/ptg[1] v ss tdi/ptg[0] /ptf[4] audata[3]/ptf[3] audata[2]/ptf[2] audata[1]/ptf[1] audata[0]/ptf[0] drak1/pte[3] drak0/pte[2] dack1/pte[1] dack0/pte[0] /ptd[5] cke/ptd[4] /ptd[3] /ptd[2] /ptd[1] /ptd[0] v cc q /ptd[7] v ss q /ptd[6] / /ptc[7] / /ptc[6] /ptc[5] 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 sh-7706 fp-176c (top view) status0/pte[4] status1/pte[5] tclk/pte[6] /pte[7] v ss q ckio v cc q txd0/scpt[0] sck0/scpt[1] txd2/scpt[2] sck2/scpt[3] /scpt[4] rxd0/scpt[0] rxd2/scpt[2] /irq5/scpt[5] v ss v cc irq0/ /pth[0] irq1/ /pth[1] irq2/ /pth[2] irq3/ /pth[3] irq4/pth[4] v ss q nmi v cc q audck/ptg[4] /pth[5] /pth[6] /ptg[5] md0 md2 ca md3 md4 md5 av ss an[0]/ptj[0] an[1]/ptj[1] an[2]/da[1]/ptj[2] an[3]/da[2]/ptj[3] av cc av ss /ptc[4] /ptc[3] v cc q v ss q rd/ / / /ptc[2] / / /ptc[1] / / / /ptc[0] a25 a24 a23 v cc a22 v ss a21 a20 a19 a18 a17 a16 a15 v cc q a14 v ss q a13 a12 a11 a10 a9 a8 a7 a6 a5 v cc q a4 v ss q a3 a2 a1 a0 1.9v v cc 1.9v gnd 3.3v v cc 3.3v gnd index mark figure 1.2 pin assignment (fp-176c)
rev. 4.00, 03/04, page 5 of 660 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 abcdefghj klmnprtu abcdefghj klmnprtu sh7706 tbp-208a (top view) index mark note: section in the dotted lines are perspective view. figure 1.3 pin assignment (tbp-208a)
rev. 4.00, 03/04, page 6 of 660 1.4 pin function number of pins fp-176c tbp-208a pin name i/o description 1c3v cc -rtc * 1 ? rtc power supply (1.9 v) 2 c2 xtal2 o on-chip rtc crystal oscillator pin 3 c1 extal2 i on-chip rtc crystal oscillator pin 4d3v ss -rtc * 1 ? rtc power supply (0 v) 5 f4 d31/ptb[7] i/o data bus / input/output port b 6 f3 d30/ptb[6] i/o data bus / input/output port b 7 f2 d29/ptb[5] i/o data bus / input/output port b 8 f1 d28/ptb[4] i/o data bus / input/output port b 9 g4 d27/ptb[3] i/o data bus / input/output port b 10 g3 d26/ptb[2] i/o data bus / input/output port b 11 g2 v ss q ? input/output power supply (0 v) 12 g1 d25/ptb[1] i/o data bus / input/output port b 13 h4 v cc q ? input/output power supply (3.3 v) 14 h3 d24/ptb[0] i/o data bus / input/output port b 15 h2 d23/pta[7] i/o data bus / input/output port a 16 h1 d22/pta[6] i/o data bus / input/output port a 17 j4 d21/pta[5] i/o data bus / input/output port a 18 j2 d20/pta[4] i/o data bus / input/output port a 19 j1 v ss ? internal power supply (0 v) 20 j3 d19/pta[3] i/o data bus / input/output port a 21 k1 v cc ? internal power supply (1.9 v) 22 k2 d18/pta[2] i/o data bus / input/output port a 23 k3 d17/pta[1] i/o data bus / input/output port a 24 k4 d16/pta[0] i/o data bus / input/output port a 25 l1 v ss q ? input/output power supply (0 v) 26 l2 d15 i/o data bus 27 l3 v cc q ? input/output power supply (3.3 v) 28 l4 d14 i/o data bus 29 m1 d13 i/o data bus
rev. 4.00, 03/04, page 7 of 660 number of pins fp-176c tbp-208a pin name i/o description 30 m2 d12 i/o data bus 31 m3 d11 i/o data bus 32 m4 d10 i/o data bus 33 n1 d9 i/o data bus 34 n2 d8 i/o data bus 35 n3 d7 i/o data bus 36 n4 d6 i/o data bus 37 p1 v ss q ? input/output power supply (0 v) 38 p2 d5 i/o data bus 39 p3 v cc q ? input/output power supply (3.3 v) 40 r1 d4 i/o data bus 41 r2 d3 i/o data bus 42 p4 d2 i/o data bus 43 t1 d1 i/o data bus 44 t2 d0 i/o data bus 45 u1 a0 o address bus 46 u2 a1 o address bus 47 r3 a2 o address bus 48 t3 a3 o address bus 49 u3 v ss q ? input/output power supply (0 v) 50 r4 a4 o address bus 51 t4 v cc q ? input/output power supply (3.3 v) 52 u4 a5 o address bus 53 p5 a6 o address bus 54 r5 a7 o address bus 55 t5 a8 o address bus 56 u5 a9 o address bus 57 p6 a10 o address bus 58 r6 a11 o address bus 59 t6 a12 o address bus
rev. 4.00, 03/04, page 8 of 660 number of pins fp-176c tbp-208a pin name i/o description 60 u6 a13 o address bus 61 p7 v ss q ? input/output power supply (0 v) 62 r7 a14 o address bus 63 t7 v cc q ? input/output power supply (3.3 v) 64 u7 a15 o address bus 65 p8 a16 o address bus 66 r8 a17 o address bus 67 t8 a18 o address bus 68 u8 a19 o address bus 69 p9 a20 o address bus 70 t9 a21 o address bus 71 u9 v ss ? internal power supply (0 v) 72 r9 a22 o address bus 73 u10 v cc ? internal power supply (1.9 v) 74 t10 a23 o address bus 75 p10 a24 o address bus 76 t11 a25 o address bus 77 r11 bs /ptc[0] o / i/o bus cycle start signal / input/output port c 78 p11 rd o read strobe 79 u12 we0 / dqmll o d7 to d0 select signal / dqm (sdram) 80 t12 we1 / dqmlu / we o d15 to d8 select signal / dqm (sdram) / write strobe (pcmcia) 81 r12 we2 / dqmul / iciord /ptc[1] o/o/ o / i/o d23tod16selectsignal/ dqm (sdram) / pcmcia input/output read / input/output port c 82 p12 we3 / dqmuu / iciowr /ptc[2] o/o/ o / i/o d31tod24selectsignal/ dqm (sdram) / pcmcia input/output write / input/output port c 83 u13 rd /wr o read/write
rev. 4.00, 03/04, page 9 of 660 number of pins fp-176c tbp-208a pin name i/o description 84 r13 v ss q ? input/output power supply (0 v) 85 p13 cs0 o chip select 0 86 u14 v cc q ? input/output power supply (3.3 v) 87 t14 cs2 /ptc[3] o / i/o chip select 2 / input/output port c 88 r14 cs3 /ptc[4] o / i/o chip select 3 / input/output port c 89 u17 cs4 /ptc[5] o / i/o chip select 4 / input/output port c 90 t17 cs5 / ce1a /ptc[6] o / o / i/o chip select 5 / ce1 (area 5 pcmcia) / input/output port c 91 r15 cs6 / ce1b /ptc[7] o / o / i/o chip select 6 / ce1 (area 6 pcmcia) / input/output port c 92 r16 ce2a /ptd[6] o / i/o area 5 pcmcia ce2 / input/output port d 93 r17 v ss q ? input/output power supply (0 v) 94 p15 ce2b /ptd[7] o / i/o area 6 pcmcia ce2 / input/output port d 95 p16 v cc q ? input/output power supply (3.3 v) 96 p17 rasl /ptd[0] o / i/o lower 32 mbytes address ras (sdram) / input/output port d 97 n14 rasu /ptd[1] o / i/o upper 32 mbytes address ras (sdram) / input/output port d 98 n15 casl /ptd[2] o / i/o lower 32 mbytes address cas (sdram) / input/output port d 99 n16 casu /ptd[3] o / i/o upper 32 mbytes address cas (sdram) / input/output port d 100 n17 cke/ptd[4] o / i/o ck enable (sdram) / input/output port d 101 m14 iois16 /ptd[5] i / i/o iois16 (pcmcia) / input port d 102 m15 back o bus acknowledge 103 m16 breq i bus request 104 m17 wait i hardware wait request 105 l14 dack0/pte[0] o / i/o dma acknowledge 0 / input/output port e 106 l15 dack1/pte[1] o / i/o dma acknowledge 1 / input/output port e
rev. 4.00, 03/04, page 10 of 660 number of pins fp-176c tbp-208a pin name i/o description 107 l16 drak0/pte[2] o / i/o dma request acknowledge / input/output port e 108 l17 drak1/pte[3] o / i/o dma request acknowledge / input/output port e 109 k15 audata[0]/ptf[0] i/o aud data / input/output port f 110 k16 audata[1]/ptf[1] i/o aud data / input/output port f 111 k17 audata[2]/ptf[2] i/o aud data / input/output port f 112 j14 audata[3]/ptf[3] i/o aud data / input/output port f 113 j16 audsync /ptf[4] o / i/o aud synchronous / input/output port f 114 j17 tdi/ptg[0] i data input (h-udi) / input port g 115 j15 v ss ? internal power supply (0 v) 116 h17 tck/ptg[1] i clock (h-udi) / input port g 117 h16 v cc ? internal power supply (1.9 v) 118 g16 tms/ptg[2] i mode select (h-udi) / input port g 119 g15 trst /ptg[3] i reset (h-udi) / input port g 120 g14 tdo/ptf[5] o / i/o data output (h-udi) / input/output port f 121 f16 asebrkak /ptf[6] o / i/o ase break acknowledge (h-udi) / input/output port f 122 f15 asemd0 * 3 i ase mode (h-udi) 123 e17 v cc -pll1 * 2 ? pll1 power supply (1.9 v) 124 e16 cap1 ? pll1 external capacitance pin 125 e15 v ss -pll1 * 2 ? pll1 power supply (0 v) 126 e14 v ss -pll2 * 2 ? pll2 power supply (0 v) 127 d17 cap2 ? pll2 external capacitance pin 128 d16 v cc -pll2 * 2 ? pll2 power supply (1.9 v) 129 c17 md1 i clock mode setting 130 c16 v ss ? internal power supply (0 v) 131 b17 xtal o clock oscillator pin 132 b16 extal i external clock / crystal oscillator pin
rev. 4.00, 03/04, page 11 of 660 number of pins fp-176c tbp-208a pin name i/o description 133 a17 status0/pte[4] o / i/o processor status / input/output port e 134 a16 status1/pte[5] o / i/o processor status / input/output port e 135 c15 tclk/pte[6] i/o tmu or rtc clock input/output / input/output port e 136 b15 irqout /pte[7] o / i/o interrupt request notification / input/output port e 137 a15 v ss q ? input/output power supply (0 v) 138 c14 ckio i/o system clock input/output 139 b14 v cc q ? input/output power supply (3.3 v) 140 a14 txd0/scpt[0] o sci transmit data 0 / sc port 141 d13 sck0/scpt[1] i/o sci clock 0 / sc port 142 c13 txd2/scpt[2] o scif transmit data 2 / sc port 143 b13 sck2/scpt[3] i/o scif clock 2 / sc port 144 a13 rts2 /scpt[4] o / i/o scif transmit request 2 / sc port 145 d12 rxd0/scpt[0] i sci receive data 0 / sc port 146 c12 rxd2/scpt[2] i scif receive data 2 / sc port 147 b12 cts2 /irq5/scpt[5] i scif transmit clear / external interruption request / sc port 148 d11 v ss ? internal power supply (0 v) 149 c11 resetm i manual reset request 150 b11 v cc ? internal power supply (1.9 v) 151 a11 irq0/ irl0 /pth[0] i/i/i/o externalinterruptrequest / input/output port h 152 d10 irq1/ irl1 /pth[1] i/i/i/o externalinterruptrequest / input/output port h 153 c10 irq2/ irl2 /pth[2] i/i/i/o externalinterruptrequest / input/output port h 154 b10 irq3/ irl3 /pth[3] i/i/i/o externalinterruptrequest / input/output port h 155 a10 irq4/pth[4] i / i/o external interrupt request / input/output port h
rev. 4.00, 03/04, page 12 of 660 number of pins fp-176c tbp-208a pin name i/o description 156 d9 v ss q ? input/output power supply (0 v) 157 b9 nmi i nonmaskable interrupt request 158 a9 v cc q ? input/output power supply (3.3 v) 159 c9 audck/ptg[4] i aud clock / input port g 160 a8 dreq0 /pth[5] i / i/o dma request / input/output port h 161 b8 dreq1 /pth[6] i / i/o dma request / input/output port h 162 c8 adtrg /ptg[5] i analog trigger / input port g 163 d8 md0 i clock mode setting 164 b7 md2 i clock mode setting 165 a6 resetp i power-on reset request 166 b6 ca i chip activate / hardware standby request 167 c6 md3 i area 0 bus width setting 168 d6 md4 i area 0 bus width setting 169 a5 md5 i endian setting 170 b5 av ss ? analog power supply (0 v) 171 c5 an[0]/ptj[0] i a/d converter input / input port j 172 d5 an[1]/ptj[1] i a/d converter input / input port j 173 a4 an2[2]/da[1]/ptj[2] i / o / i a/d converter input / d/a converter output / input port j 174 b4 an3[3]/da[0]/ptj[3] i / o / i a/d converter input / d/a converter output / input port j 175 b3 av cc ? analog power supply (3.3 v) 176 b2 av ss ? analog power supply (0 v) notes: except in hardware standby mode, all v cc /v ss pins must be connected to the system power supply. (supply power constantly.) in hardware standby mode, power must be supplied at least to v cc ?rtc and v ss ?rtc. if power is not supplied to v cc and v ss pins other than v cc ?rtc and v ss ?rtc, hold the ca pin low. in the tbp-208a package, the a1, a2, a3, a7, a12, b1, c4, c7, d1, d2, d4, d7, d14, d15, e1, e2, e3, e4, f14, f17, g17, h14, h15, k14, p14, r10, t13, t15, t16, u11, u15, and u16 pins must be connected to v ss . 1. must be connected to the power supply even when the rtc is not used. 2. must be connected to the power supply even when the on-chip pll circuits are not used (except in hardware standby mode). 3. must be high level when the user system is used independently without using the emulator or h-udi. when this pin goes low or is open, the resetp pin may be masked. (see section 21, user debugging interface (h-udi).)
rev. 4.00, 03/04, page 13 of 660 section 2 cpu 2.1 register description 2.1.1 privileged mode and banks processor modes: there are two processor modes: user mode and privileged mode. the sh7706 normally operates in user mode, and enters privileged mode when an exception occurs or an interrupt is accepted. there are three kinds of registers?general registers, system registers, and control registers?and the registers that can be accessed differ in the two processor modes. general registers: there are 16 general registers, designated r0 to r15. general registers r0 to r7 are banked registers which are switched by a processor mode change. in privileged mode, the register bank bit (rb) in the status register (sr) defines which banked register set is accessed as general registers, and which set is accessed only through the load control register (ldc) and store control register (stc) instructions. when the rb bit is 1, bank1 general registers r0_bank1 to r7_bank1 and non-banked general registers r8 to r15 function as the general register set, with bank0 general registers r0_bank0 to r7_bank0 accessed only by the ldc/stc instructions. when the rb bit is 0, bank0 general registers r0_bank0 to r7_bank0 and nonbanked general registers r8 to r15 function as the general register set, with bank1 general registers r0_bank1 to r7_bank1 accessed only by the ldc/stc instructions. in user mode, the 16 registers comprising bank 0 general registers r0_bank0 to r7_bank0 and non-banked registers r8 to r15 can be accessed as general registers r0 to r15, and bank 1 general registers r0_bank1 to r7_bank1 cannot be accessed. control registers: control registers comprise the global base register (gbr) and status register (sr) which can be accessed in both processor modes, and the saved status register (ssr), saved program counter (spc), and vector base register (vbr) which can only be accessed in privileged mode. some bits of the status register (such as the rb bit) can only be accessed in privileged mode. system registers: system registers comprise the multiply and accumulate registers (macl/mach), the procedure register (pr), and the program counter (pc). access to these registers does not depend on the processor mode. the register configuration in each mode is shown in figures 2.1. switching between user mode and privileged mode is controlled by the processor mode bit (md) in the status register.
rev. 4.00, 03/04, page 14 of 660 31 0 r0_bank0 * 1 * 2 r1_bank0 * 2 r2_bank0 * 2 r3_bank0 * 2 r4_bank0 * 2 r5_bank0 * 2 r6_bank0 * 2 r7_bank0 * 2 r8 r9 r10 r11 r12 r13 r14 r15 sr gbr mach macl pr pc 31 0 r0_bank1 * 1 * 3 r1_bank1 * 3 r2_bank1 * 3 r3_bank1 * 3 r4_bank1 * 3 r5_bank1 * 3 r6_bank1 * 3 r7_bank1 * 3 r8 r9 r10 r11 r12 r13 r14 r15 r0_bank0 * 1 * 4 r1_bank0 * 4 r2_bank0 * 4 r3_bank0 * 4 r4_bank0 * 4 r5_bank0 * 4 r6_bank0 * 4 r7_bank0 * 4 gbr mach macl vbr pr sr ssr pc spc 31 0 r0_bank1 * 1 * 3 r1_bank1 * 3 r2_bank1 * 3 r3_bank1 * 3 r4_bank1 * 3 r5_bank1 * 3 r6_bank1 * 3 r7_bank1 * 3 r8 r9 r10 r11 r12 r13 r14 r15 r0_bank0 * 1 * 4 r1_bank0 * 4 r2_bank0 * 4 r3_bank0 * 4 r4_bank0 * 4 r5_bank0 * 4 r6_bank0 * 4 r7_bank0 * 4 gbr mach macl vbr pr sr ssr pc spc a. user mode register configuration notes: 1. 2. 3. 4. b. privileged mode register configuration (rb = 1) c. privileged mode register configuration (rb = 0) r0 functions as an index register in the indexed register-indirect addressing mode and indexed gbr-indirect addressing mode. banked register banked register when the rb bit of the sr register is 1, the register can be accessed for general use. when the rb bit is 0, it can only be accessed with the ldc/stc instruction. banked register when the rb bit of the sr register is 0, the register can be accessed for general use. when the rb bit is 1, it can only be accessed with the ldc/stc instruction. figure 2.1 register configuration
rev. 4.00, 03/04, page 15 of 660 register values after a reset are shown in table 2.1. table 2.1 initial register values type registers initial value * general registers r0 to r15 undefined sr md bit = 1, rb bit = 1, bl bit = 1, i3 to i0 = 1111 (h'f), reserved bits = 0, others undefined gbr, ssr, spc undefined control registers vbr h'00000000 mach, macl, pr undefined system registers pc h'a0000000 note: * initial value is set at power-on-reset or manual-reset. 2.1.2 general registers there are 16 general registers, designated r0 to r15. general registers r0 to r7 are banked registers, with a different r0 to r7 register bank (r0_bank0 to r7_bank0 or r0_bank1 to r7_bank1) being accessed according to the processor mode. for details, see figure 2.1. the general register configuration is shown in figure 2.2. 31 0 r0 * 1 * 2 general registers r1 * 2 r2 * 2 r3 * 2 r4 * 2 r5 * 2 r6 * 2 r7 * 2 r8 r9 r10 r11 r12 r13 r14 r15 notes: 1. r0 functions as an index register in the indexed register-indirect addressing mode and indexed gbr-indirect addressing mode. in some instructions, only r0 can be used as the source register or destination register. 2. r0 to r7 are banked registers. in privileged mode, sr.rb specifies which banked registers are accessed as general registers (r0_bank0 to r7_bank0 or r0_bank1 to r7_bank1). initialized to undefined by a reset. figure 2.2 general registers
rev. 4.00, 03/04, page 16 of 660 2.1.3 system registers system registers can be accessed by the lds and sts instructions. when an exception occurs, the contents of the program counter (pc) are saved in the saved program counter (spc). the spc contents are restored to the pc by the rte instruction used at the end of the exception handling. there are three system registers, as follows. ? multiply and accumulate register (mac) ? procedure register (pr) ? program counter (pc) the system register configuration is shown in figure 2.3. 31 0 31 0 31 0 multiply and accumulate register (mac) procedure register (pr) program counter (pc) pr pc mach macl figure 2.3 system registers 1. multiply and accumulate register (mac) multiply and accumulate register is consist of higher part register (mach) and lower part register (macl). store the results of multiply-and-accumulate operations. initialized to undefined by a reset. 2. procedure register (pr) stores the return address for exiting a subroutine procedure. initialized to undefined by a reset. 3. program counter (pc) indicates the address four addresses (two instructions) ahead of the currently executing instruction. initialized to h'a0000000 by a reset.
rev. 4.00, 03/04, page 17 of 660 2.1.4 control registers control registers can be accessed in privileged mode using the ldc and stc instructions. the gbr register can also be accessed in user mode. there are five control registers, as follows: ? status register (sr) ? saved status register (ssr) ? saved program counter (spc) ? global base register (gbr) ? vector base register (vbr) the control register configuration is shown in figure 2.4. ssr saved status register (ssr) saved program counter (spc) global base register (gbr) vector base register (vbr) 31 0 spc 31 0 gbr 31 0 vbr 31 0 status register (sr) sr 31 0 figure 2.4 control registers
rev. 4.00, 03/04, page 18 of 660 ? status register (sr) the information of system status are set in this register. bit bit name initial value r/w description 31 ? 0rreserved these bits always read as 0, and the write value should always be 0. 30 md 1 r/w processor operation mode bit indicates the processor operation mode. 0: user mode 1: privileged mode md is set to 1 when an exception or interruption is occurred. 29 rb 1 r/w register bank bit determines the bank of general registers r0 to r7 used in privileged mode. 1: r0_bank1 to r7_bank1 and r8 to r15 are general registers, and r0_bank0 to r7_bank0 can be accessed by ldc/stc instructions. 0: r0_bank0 to r7_bank0 and r8 to r15 are general registers, and r0_bank1 to r7_bank1 can be accessed by ldc/stc instructions. rb is set to 1 when an exception or interruption is occurred. 28 bl 1 r/w block bit 0: exceptions and interrupts are accepted. 1: exceptions and interrupts are suppressed. see section 4, exception processing, for details. bl is set to 1 when an exception or interruption is occurred. 27 to 13 ? all 0 r reserved these bits always read as 0, and the write value should always be 0. 12 cl 0 r/w cache lock bit 0: cache look function is disabled. 1: cache look function is enabled.
rev. 4.00, 03/04, page 19 of 660 bit bit name initial value r/w description 11, 10 ? all 0 r reserved these bits always read as 0, and the write value should always be 0. 9 8 m q ? ? r/w r/w mbit qbit used by the div0s/u and div1 instructions. 7 6 5 4 i3 i2 i1 i0 1 1 1 1 r/w r/w r/w r/w interrupt mask bits 4-bit field indicating the interrupt request mask level. i3 to i0 do not change to the interrupt acceptance level when an interrupt is occurred. 3, 2 ? all 0 r reserved these bits always read as 0, and the write value should always be 0. 1s ? r/w s bit used by the mac instruction. 0t ? r/w t bit used by the movt, cmp/cond, tas, tst, bt, bf, sett, clrt, and dt instructions to indicate true (1) or false (0). used by the addv/c, subv/c, div0u/s, div1, negc, shar/l, shlr/l, rotr/l, and rotcr/l instructions to indicate a carry, borrow, overflow, or underflow. note: the m, q, s and t bits can be set or cleared by special instructions in user mode. their values are undefined after a reset. all other bits can be read or written in privileged mode. ? saved status register (ssr) stores current sr value at time of exception to indicate processor status in return to instruction stream from exception handler. initialized to undefined by a reset. ? saved program counter (spc) stores current pc value at time of exception to indicate return address at completion of exception handling. initialized to undefined by a reset.
rev. 4.00, 03/04, page 20 of 660 ? global base register (gbr) stores base address of gbr-indirect addressing mode. the gbr-indirect addressing mode is used for on-chip supporting module register area data transfers and logic operations. the gbr register can also be accessed in user mode. initialized to undefined by a reset. ? vector base register (vbr) stores base address of exception handling vector area. initialized to h'0000000 by a reset. 2.2 data formats 2.2.1 data format in registers register operands are always longwords (32 bits). when a memory operand is only a byte (8 bits) or a word (16 bits), the sign is extended to the longword, and stores into the register. longword 31 0 2.2.2 data format in memory memory data formats are classified into bytes, words, and longwords. memory can be accessed in 8-bit byte, 16-bit word, or 32-bit longword form. a memory operand less than 32 bits in length is sign-extended before being stored in a register. a word operand must be accessed starting from a word boundary (even address of a 2-byte unit: address 2n), and a longword operand starting from a longword boundary (even address of a 4-byte unit: address 4n). an address error will result if this rule is not observed. a byte operand can be accessed from any address. big-endian or little-endian byte order can be selected for the data format. the endian mode should be set with the md5 external pin in a power-on reset. big-endian mode is selected when the md5 pin is low, and little-endian when high. the endian mode cannot be changed dynamically. bit positions are numbered left to right from most-significant to least-significant. thus, in a 32-bit longword, the leftmost bit, bit 31, is the most significant bit and the rightmost bit, bit 0, is the least significant bit.
rev. 4.00, 03/04, page 21 of 660 the data format in memory is shown in figure 2.5. longword longword 31 0 15 23 7 byte0 byte1 byte2 byte3 word1 big-endian mode word0 address a + 4 address a + 8 address a + 4 address a address a address a + 1 address a + 3 31 0 15 23 7 byte3 byte2 byte1 byte0 word0 little-endian mode word1 address a + 11 address a + 10 address a + 8 address a address a + 8 address a + 9 address a + 2 figure 2.5 data format in memory 2.3 instruction features 2.3.1 execution environment data length: the instruction set is implemented with fixed-length 16-bit wide instructions executed in a pipelined sequence with single-cycle execution for most instructions. all operations are executed in 32-bit longword units. memory can be accessed in 8-bit byte, 16-bit word, or 32- bit longword units, with byte or word units sign-extended into 32-bit longwords. literals are sign- extended in arithmetic operations (mov, add, and cmp/eq instructions) and zero-extended in logical operations (tst, and, or, and xor instructions). load/store architecture: the load-store architecture is used, so basic operations are executed by the registers. operations requiring memory access are executed in registers following register loading, except for bit-manipulation operations such as logical and functions, which are executed directly in memory. delayed branching: unconditional branching is implemented as delayed branch operations. pipeline disruptions due to branching are minimized by the execution of the instruction following the delayed branch instruction prior to branching. conditional branch instructions are of two kinds, delayed and normal. bra trget add r1, r0 ;add is executed prior to branching to trget
rev. 4.00, 03/04, page 22 of 660 tbit: the t bit in the status register (sr) is used to indicate the result of compare operations, and is read as a true/false condition determining if a conditional branch is taken or not. to improve processing speed, the t bit logic state is modified only by specific operations. an example of how the t bit may be used in a sequence of operations is shown below. add #1, r0 ;t bit not modified by add operation cmp/eq r1, r0 ;t bit set to 1 when r0 = 0 bt trget ;branch taken to trget when t bit = 1 (r0 = 0) literals: byte-length literals are inserted directly into the instruction code as immediate data. to maintain the 16-bit fixed-length instruction code, word or longword literals are stored in a table in main memory rather than inserted directly into the instruction code. the memory table is accessed by the mov instruction using pc-relative addressing with displacement, as follows: mov.w @(disp, pc), r0 absolute addresses: as with word and longword literals, absolute addresses must also be stored in a table in main memory. the value of the absolute address is transferred to a register and the operand access is specified by indexed register-indirect addressing, with the absolute address loaded (like word and longword immediate data) during instruction execution. 16-bit and 32-bit displacements: in the same way, 16-bit and 32-bit displacements also must be stored in a table in main memory. exactly like absolute addresses, the displacement value is transferred to a register and the operand access is specified by indexed register-indirect addressing, loading the displacement (like word and longword immediate data) during instruction execution.
rev. 4.00, 03/04, page 23 of 660 2.3.2 addressing modes addressing modes and effective address calculation methods are shown in table 2.2. table 2.2 addressing modes and effective addresses addressing mode instruction format effective address calculation method calculation formula register direct rn effective address is register rn. (operand is register rn contents.) ? register indirect @rn effective address is register rn contents. rn rn rn register indirect with post- increment @rn+ effective address is register rn contents. a constant is added to rn after instruction execution: 1 for a byte operand, 2 for a word operand, 4 for a longword operand. rn rn 1/2/4 + rn + 1/2/4 rn after instruction execution byte: rn + 1 rn word: rn + 2 rn longword: rn + 4 rn register indirect with pre- decrement @?rn effective address is register rn contents, decremented by a constant beforehand: 1 for a byte operand, 2 for a word operand, 4 for a longword operand. rn 1/2/4 rn ? 1/2/4 ? rn ? 1/2/4 byte:rn?1 rn word: rn ? 2 rn longword: rn ? 4 rn (instruction executed with rn after calculation)
rev. 4.00, 03/04, page 24 of 660 addressing mode instruction format effective address calculation method calculation formula register indirect with displacement @(disp:4, rn) effective address is register rn contents with 4-bit displacement disp added. after disp is zero-extended, it is multiplied by 1 (byte), 2 (word), or 4 (longword), according to the operand size. rn 1/2/4 + byte: rn + disp word: rn + disp 2 longword: rn + disp 4 indexed register indirect @(r0, rn) effective address is sum of register rn and r0 contents. rn r0 rn + r0 + rn + r0 gbr indirect with displacement @(disp:8, gbr) effective address is register gbr contents with 8-bit displacement disp added. after disp is zero-extended, it is multiplied by 1 (byte), 2 (word), or 4 (longword), according to the operand size. gbr 1/2/4 + byte: gbr + disp word: gbr + disp 2 longword: gbr + disp 4 indexed gbr indirect @(r0, gbr) effective address is sum of register gbr and r0 contents. gbr r0 gbr + r0 + gbr + r0
rev. 4.00, 03/04, page 25 of 660 addressing mode instruction format effective address calculation method calculation formula pc-relative with displacement @(disp:8, pc) effective address is register pc contents with 8-bit displacement disp added. after disp is zero-extended, it is multiplied by 2 (word), or 4 (longword), according to the operand size. with a longword operand, the lower 2 bits of pc are masked. pc h'fffffffc + 2/4 x & (for longword) disp (zero-extended) pc + disp word: pc + disp 2 longword: pc & h'ffff fffc + disp 4 disp:8 effective address is register pc contents with 8-bit displacement disp added after being sign-extended and multiplied by 2. pc 2 + pc + disp 2 pc-relative disp:12 effective address is register pc contents with 12-bit displacement disp added after being sign-extended and multiplied by 2. pc 2 + pc + disp 2
rev. 4.00, 03/04, page 26 of 660 addressing mode instruction format effective address calculation method calculation formula pc-relative rn effective address is sum of register pc and rn contents. pc r0 + pc + r0 pc + rn #imm:8 8-bit immediate data imm of tst, and, or, or xor instruction is zero-extended. ? #imm:8 8-bit immediate data imm of mov, add, or cmp/eq instruction is sign-extended. ? immediate #imm:8 8-bit immediate data imm of trapa instruction is zero-extended and multiplied by 4. ? note: for the addressing modes below that use a displacement (disp), the assembler descriptions in this manual show the value before scaling ( 1, 2, or 4) is performed according to the operand size. this is done to clarify the operation of the lsi. refer to the relevant assembler notation rules for the actual assembler descriptions. @ (disp:4, rn) ; register indirect with displacement @ (disp:8, rn) ; gbr indirect with displacement @ (disp:8, pc) ; pc-relative with displacement disp:8, disp:12; pc-relative
rev. 4.00, 03/04, page 27 of 660 2.3.3 instruction formats table 2.3 explains the meaning of instruction formats and source and destination operands. the meaning of the operands depends on the operation code. the following symbols are used. xxxx: operation code mmmm: source register nnnn: destination register iiii: immediate data dddd: displacement table 2.3 instruction formats instruction format source operand destination operand instruction example 0format xxxx xxxx xxxx xxxx 15 0 ??nop ? nnnn: register direct movt rn control register or system register nnnn: register direct sts mach,rn nformat xxxx xxxx xxxx nnnn 15 0 control register or system register nnnn: register indirect with pre- decrement stc.l sr,@?rn mmmm: register direct control register or system register ldc rm,sr mmmm: register indirect with post- increment control register or system register ldc.l @rm+,sr mmmm: register indirect ?jmp @rm m format xxxx mmmm xxxx xxxx 15 0 mmmm: pc- relative using rm ?braf rm
rev. 4.00, 03/04, page 28 of 660 instruction format source operand destination operand instruction example mmmm: register direct nnnn: register direct add rm,rn mmmm: register indirect nnnn: register indirect mov.l rm,@rn mmmm: register indirect with post- increment (multiply-and- accumulate operation) nnnn: * register indirect with post- increment (multiply-and- accumulate operation) mach,macl mac.w @rm+,@rn+ mmmm: register indirect with post- increment nnnn: register direct mov.l @rm+,rn mmmm: register direct nnnn: register indirect with pre- decrement mov.l rm,@?rn nm format nnnn xxxx xxxx 15 0 mmmm mmmm: register direct nnnn: indexed register indirect mov.l rm,@(r0,rn) md format xxxx dddd 15 0 mmmm xxxx mmmmdddd: register indirect with displacement r0 (register direct) mov.b @(disp,rm),r 0 nd4 format dddd nnnn xxxx 15 0 xxxx r0 (register direct) nnnndddd: register indirect with displacement mov.b r0,@(disp,rn)
rev. 4.00, 03/04, page 29 of 660 instruction format source operand destination operand instruction example mmmm: register direct nnnndddd: register indirect with displacement mov.l rm,@(disp,rn) nmd format nnnn xxxx dddd 15 0 mmmm mmmmdddd: register indirect with displacement nnnn: register direct mov.l @(disp,rm),rn dddddddd: gbr indirect with displacement r0 (register direct) mov.l @(disp,gbr),r 0 r0 (register direct) dddddddd: gbr indirect with displacement mov.l r0,@(disp,gb r) dddddddd: pc-relative with displacement r0 (register direct) mova @(disp,pc),r0 dformat dddd xxxx 15 0 xxxx dddd dddddddd: pc-relative ? bf label d12 format dddd xxxx 15 0 dddd dddd dddddddddddd: pc-relative ? bra label (label = disp + pc) nd8 format dddd nnnn xxxx 15 0 dddd dddddddd: pc-relative with displacement nnnn: register direct mov.l @(disp,pc),rn iiiiiiii: immediate indexed gbr indirect and.b #imm, @(r0,gbr) iiiiiiii: immediate r0 (register direct) and #imm,r0 iformat i i i i xxxx 15 0 xxxx i i i i iiiiiiii: immediate ? trapa #imm ni format nnnn i i i i xxxx 15 0 i i i i iiiiiiii: immediate nnnn: register direct add #imm,rn note: * in a multiply-and-accumulate instruction, nnnn is the source register. .
rev. 4.00, 03/04, page 30 of 660 2.4 instruction set 2.4.1 instruction set classified by function the sh7706 instruction set includes 68 basic instruction types, as listed in table 2.4. table 2.4 classification of instructions classification types operation code function no. of instructions mov data transfer mova effective address transfer movt t bit transfer swap swap of upper and lower bytes data transfer 5 xtrct extraction of middle of linked registers 39 add binary addition addc binary addition with carry addv binary addition with overflow check cmp/cond comparison div1 division div0s initialization of signed division div0u initialization of unsigned division dmuls signed double-precision multiplication dmulu unsigned double-precision multiplication dt decrement and test exts sign extension extu zero extension arithmetic operations 21 mac multiply-and-accumulate operation, double- precision multiply-and-accumulate operation 33
rev. 4.00, 03/04, page 31 of 660 classification types operation code function no. of instructions mul double-precision multiplication (32 32 bits) muls signed multiplication (16 16 bits) mulu unsigned multiplication (16 16 bits) neg negation negc negation with borrow sub binary subtraction subc binary subtraction with borrow arithmetic operations 21 subv binary subtraction with underflow check 33 and logical and not bit inversion or logical or tas memory test and bit set tst logical and and t bit set logic operations 6 xor exclusive or 14 rotl one-bit left rotation rotr one-bit right rotation rotcl one-bit left rotation with t bit rotcr one-bit right rotation with t bit shal one-bit arithmetic left shift shar one-bit arithmetic right shift shll one-bit logical left shift shlln n-bit logical left shift shlr one-bit logical right shift shlrn n-bit logical right shift shad dynamic arithmetic shift shift 12 shld dynamic logical shift 16
rev. 4.00, 03/04, page 32 of 660 classification types operation code function no. of instructions bf conditional branch, delayed conditional branch (t = 0) bt conditional branch, delayed conditional branch (t = 1) bra unconditional branch braf unconditional branch bsr branch to subroutine procedure bsrf branch to subroutine procedure jmp unconditional branch jsr branch to subroutine procedure branch 9 rts return from subroutine procedure 11 clrmac mac register clear clrt clear t bit clrs clear s bit ldc load to control register lds load to system register ldtlb load pte to tlb nop no operation pref prefetch data to cache rte return from exception handling sets set s bit sett set t bit sleep shift to power-down mode stc store from control register sts store from system register system control 15 trapa trap exception handling 75 total: 68 188
rev. 4.00, 03/04, page 33 of 660 the instruction codes are listed from tables 2.5 to 2.10. those tables are described according to the following items. item format explanation instruction mnemonic op.sz src,dest op: operation code sz: size src: source dest: destination rm: source register rn: destination register imm: immediate data disp: displacement instruction code msb ? lsb mmmm: source register nnnn: destination register 0000: r0 0001: r1 ........... 1111: r15 iiii: immediate data dddd: displacement * operation summary , (xx) m/q/t & | ^ ~ <>n direction of transfer memory operand flag bits in sr logical and of each bit logical or of each bit exclusiveorofeachbit logical not of each bit n-bit shift privileged mode indicates whether privileged mode applies execution cycles value when no wait states are inserted the execution cycles listed in the table are minimums. the actual number of cycles may be increased in cases such as the followings: 1. when contention occurs between instruction fetches and data access 2. when the destination register of the load instruction (memory register) and the register used by the next instruction are the same t bit value of t bit after instruction is executed ?: no change note: * scaling ( 1, 2, 4) is performed according to the instruction operand size.
rev. 4.00, 03/04, page 34 of 660 table 2.5 lists the data transfer instructions table 2.5 data transfer instructions instruction operation code privileged mode cycles t bit mov #imm,rn imm sign extension rn 1110nnnniiiiiiii ?1? mov.w @(disp,pc),rn (disp 2+pc) sign extension rn 1001nnnndddddddd ?1? mov.l @(disp,pc),rn (disp 4 +pc) rn 1101nnnndddddddd ?1? mov rm,rn rm rn 0110nnnnmmmm0011 ?1? mov.b rm,@rn rm (rn) 0010nnnnmmmm0000 ?1? mov.w rm,@rn rm (rn) 0010nnnnmmmm0001 ?1? mov.l rm,@rn rm (rn) 0010nnnnmmmm0010 ?1? mov.b @rm,rn (rm) sign extension rn 0110nnnnmmmm0000 ?1? mov.w @rm,rn (rm) sign extension rn 0110nnnnmmmm0001 ?1? mov.l @rm,rn (rm) rn 0110nnnnmmmm0010 ?1? mov.b rm,@ ? rn rn?1 rn, rm (rn) 0010nnnnmmmm0100 ?1? mov.w rm,@ ? rn rn?2 rn, rm (rn) 0010nnnnmmmm0101 ?1? mov.l rm,@ ? rn rn?4 rn, rm (rn) 0010nnnnmmmm0110 ?1? mov.b @rm+,rn (rm) sign extension rn, rm + 1 rm 0110nnnnmmmm0100 ?1? mov.w @rm+,rn (rm) sign extension rn, rm + 2 rm 0110nnnnmmmm0101 ?1? mov.l @rm+,rn (rm) rn,rm + 4 rm 0110nnnnmmmm0110 ?1? mov.b r0,@(disp,rn) r0 (disp + rn) 10000000nnnndddd ?1? mov.w r0,@(disp,rn) r0 (disp 2 +rn) 10000001nnnndddd ?1? mov.l rm,@(disp,rn) rm (disp 4 +rn) 0001nnnnmmmmdddd ?1? mov.b @(disp,rm),r0 (disp + rm) sign extension r0 10000100mmmmdddd ?1? mov.w @(disp,rm),r0 (disp 2 +rm) sign extension r0 10000101mmmmdddd ?1? mov.l @(disp,rm),rn (disp 4 +rm) rn 0101nnnnmmmmdddd ?1? mov.b rm,@(r0,rn) rm (r0 + rn) 0000nnnnmmmm0100 ?1?
rev. 4.00, 03/04, page 35 of 660 instruction operation code privileged mode cycles t bit mov.w rm,@(r0,rn) rm (r0 + rn) 0000nnnnmmmm0101 ?1? mov.l rm,@(r0,rn) rm (r0 + rn) 0000nnnnmmmm0110 ?1? mov.b @(r0,rm),rn (r0 + rm) sign extension rn 0000nnnnmmmm1100 ?1? mov.w @(r0,rm),rn (r0 + rm) sign extension rn 0000nnnnmmmm1101 ?1? mov.l @(r0,rm),rn (r0 + rm) rn 0000nnnnmmmm1110 ?1? mov.b r0,@(disp,gbr) r0 (disp + gbr) 11000000dddddddd ?1? mov.w r0,@(disp,gbr) r0 (disp 2 +gbr) 11000001dddddddd ?1? mov.l r0,@(disp,gbr) r0 (disp 4 +gbr) 11000010dddddddd ?1? mov.b @(disp,gbr),r0 (disp + gbr) sign extension r0 11000100dddddddd ?1? mov.w @(disp,gbr),r0 (disp 2 +gbr) sign extension r0 11000101dddddddd ?1? mov.l @(disp,gbr),r0 (disp 4 +gbr) r0 11000110dddddddd ?1? mova @(disp,pc),r0 disp 4 +pc r0 11000111dddddddd ?1? movt rn t rn 0000nnnn00101001 ?1? swap.b rm,rn rm swap the bottom two bytes reg 0110nnnnmmmm1000 ?1? swap.w rm,rn rm swap two consecutive words rn 0110nnnnmmmm1001 ?1? xtrct rm,rn rm: middle 32 bits of rn rn 0010nnnnmmmm1101 ?1?
rev. 4.00, 03/04, page 36 of 660 table 2.6 lists the arithmetic instructions. table 2.6 arithmetic instructions instruction operation code privileged mode cycles t bit add rm,rn rn + rm rn 0011nnnnmmmm1100 ?1? add #imm,rn rn + imm rn 0111nnnniiiiiiii ?1? addc rm,rn rn + rm + t rn, carry t 0011nnnnmmmm1110 ? 1 carry addv rm,rn rn + rm rn, overflow t 0011nnnnmmmm1111 ? 1 overflow cmp/eq #imm,r0 if r0 = imm, 1 t 10001000iiiiiiii ? 1 comparison result cmp/eq rm,rn if rn = rm, 1 t 0011nnnnmmmm0000 ? 1 comparison result cmp/hs rm,rn if rn rm with unsigned data, 1 t 0011nnnnmmmm0010 ? 1 comparison result cmp/ge rm,rn if rn rm with signed data, 1 t 0011nnnnmmmm0011 ? 1 comparison result cmp/hi rm,rn if rn > rm with unsigned data, 1 t 0011nnnnmmmm0110 ? 1 comparison result cmp/gt rm,rn if rn > rm with signed data, 1 t 0011nnnnmmmm0111 ? 1 comparison result cmp/pz rn if rn 0, 1 t 0100nnnn00010001 ? 1 comparison result cmp/pl rn if rn > 0, 1 t 0100nnnn00010101 ? 1 comparison result cmp/str rm,rn if rn and rm have an equivalent byte, 1 t 0010nnnnmmmm1100 ? 1 comparison result div1 rm,rn single-step division (rn/rm) 0011nnnnmmmm0100 ? 1 calculation result div0s rm,rn msb of rn q, msb of rm m, m ^ q t 0010nnnnmmmm0111 ? 1 calculation result div0u 0 m/q/t 0000000000011001 ?10
rev. 4.00, 03/04, page 37 of 660 instruction operation code privileged mode cycles t bit dmuls.l rm,rn signed operation of rn rm mach, macl 32 32 64 bits 0011nnnnmmmm1101 ?2to(5) * ? dmulu.l rm,rn unsigned operation of rn rm mach, macl 32 32 64 bits 0011nnnnmmmm0101 ?2to(5) * ? dt rn rn?1 rn,ifrn = 0, 1 t, else 0 t 0100nnnn00010000 ? 1 comparison result exts.b rm,rn a byte in rm is sign- extended rn 0110nnnnmmmm1110 ?1? exts.w rm,rn a word in rm is sign- extended rn 0110nnnnmmmm1111 ?1? extu.b rm,rn a byte in rm is zero- extended rn 0110nnnnmmmm1100 ?1? extu.w rm,rn a word in rm is zero- extended rn 0110nnnnmmmm1101 ?1? mac.l @rm+,@rn+ signed operation of (rn) (rm) + mac mac, rn + 4 rn, rm + 4 rm 32 32 + 64 64 bits 0000nnnnmmmm1111 ?2to(5) * ? mac.w @rm+,@rn+ signed operation of (rn) (rm) + mac mac, rn + 2 rn, rm + 2 rm 16 16 + 64 64 bits 0100nnnnmmmm1111 ?2to(5) * ? mul.l rm,rn rn rm macl 32 32 32 bits 0000nnnnmmmm0111 ?2to(5) * ? muls.w rm,rn signed operation of rn rm macl 16 16 32 bits 0010nnnnmmmm1111 ?1to(3) * ? mulu.w rm,rn unsigned operation of rn rm macl 16 16 32 bits 0010nnnnmmmm1110 ?1to(3) * ? neg rm,rn 0?rm rn 0110nnnnmmmm1011 ?1? negc rm,rn 0?rm?t rn, borrow t 0110nnnnmmmm1010 ? 1 borrow
rev. 4.00, 03/04, page 38 of 660 instruction operation code privileged mode cycles t bit sub rm,rn rn?rm rn 0011nnnnmmmm1000 ?1? subc rm,rn rn?rm?t rn, borrow t 0011nnnnmmmm1010 ? 1 borrow subv rm,rn rn?rm rn, underflow t 0011nnnnmmmm1011 ? 1 underflow note: * the normal number of execution cycles is shown. the value in parentheses is the number of cycles required in case of contention with the preceding or following instruction. table 2.7 lists the logic operation instructions. table 2.7 logic operation instructions instruction operation code privileged mode cycles t bit and rm,rn rn & rm rn 0010nnnnmmmm1001 ?1? and #imm,r0 r0 & imm r0 11001001iiiiiiii ?1? and.b #imm,@(r0,gbr) (r0 + gbr) & imm (r0 + gbr) 11001101iiiiiiii ?3? not rm,rn ~rm rn 0110nnnnmmmm0111 ?1? or rm,rn rn | rm rn 0010nnnnmmmm1011 ?1? or #imm,r0 r0 | imm r0 11001011iiiiiiii ?1? or.b #imm,@(r0,gbr) (r0 + gbr) | imm (r0 + gbr) 11001111iiiiiiii ?3? tas.b @rn * if (rn) is 0, 1 t; 1 msb of (rn) * 0100nnnn00011011 ?4test result tst rm,rn rn & rm; if the result is 0, 1 t 0010nnnnmmmm1000 ?1test result tst #imm,r0 r0 & imm; if the result is 0, 1 t 11001000iiiiiiii ?1test result tst.b #imm,@(r0,gbr) (r0 + gbr) & imm; if the result is 0, 1 t 11001100iiiiiiii ?3test result xor rm,rn rn ^ rm rn 0010nnnnmmmm1010 ?1? xor #imm,r0 r0 ^ imm r0 11001010iiiiiiii ?1? xor.b #imm,@(r0,gbr) (r0 + gbr) ^ imm (r0 + gbr) 11001110iiiiiiii ?3? note: * the on-chip dmac's bus cycle is not inserted between the read and write cycles of the tas instruction. the bus authority is not released by the breq.
rev. 4.00, 03/04, page 39 of 660 table 2.8 lists the shift instructions. table 2.8 shift instructions instruction operation code privileged mode cycles t bit rotl rn t rn msb 0100nnnn00000100 ?1msb rotr rn lsb rn t 0100nnnn00000101 ?1lsb rotcl rn t rn t 0100nnnn00100100 ?1msb rotcr rn t rn t 0100nnnn00100101 ?1lsb shad rm,rn rn 0: rn << rm rn rn < 0: rn >> rm [msb rn] 0100nnnnmmmm1100 ?1? shal rn t rn 0 0100nnnn00100000 ?1msb shar rn msb rn t 0100nnnn00100001 ?1lsb shld rm,rn rn 0: rn << rm rn rn < 0: rn >> rm [0 rn] 0100nnnnmmmm1101 ?1? shll rn t rn 0 0100nnnn00000000 ?1msb shlr rn 0 rn t 0100nnnn00000001 ?1lsb shll2 rn rn << 2 rn 0100nnnn00001000 ?1? shlr2 rn rn >> 2 rn 0100nnnn00001001 ?1? shll8 rn rn << 8 rn 0100nnnn00011000 ?1? shlr8 rn rn >> 8 rn 0100nnnn00011001 ?1? shll16 rn rn << 16 rn 0100nnnn00101000 ?1? shlr16 rn rn >> 16 rn 0100nnnn00101001 ?1?
rev. 4.00, 03/04, page 40 of 660 table 2.9 lists the branch instructions. table 2.9 branch instructions instruction operation code privileged mode cycles t bit bf label if t = 0, disp 2+pc pc; if t = 1, nop (where label is disp + pc) 10001011dddddddd ?3/1 * ? bf/s label delayed branch, if t = 0, disp 2+pc pc; if t = 1, nop 10001111dddddddd ?2/1 * ? bt label delayed branch, if t = 1, disp 2+pc pc; if t = 0, nop 10001001dddddddd ?3/1 * ? bt/s label if t = 1, disp 2+pc pc; if t = 0, nop 10001101dddddddd ?2/1 * ? bra label delayed branch, disp 2+pc pc 1010dddddddddddd ?2? braf rm delayed branch, rm + pc pc 0000mmmm00100011 ?2? bsr label delayed branch, pc pr, disp 2+pc pc 1011dddddddddddd ?2? bsrf rm delayed branch, pc pr, rm + pc pc 0000mmmm00000011 ?2? jmp @rm delayed branch, rm pc 0100mmmm00101011 ?2? jsr @rm delayed branch, pc pr, rm pc 0100mmmm00001011 ?2? rts delayed branch, pr pc 0000000000001011 ?2? note: * one state when there is no branch.
rev. 4.00, 03/04, page 41 of 660 table 2.10 lists the system control instructions. table 2.10 system control instructions instruction operation code privileged mode cycles t bit clrmac 0 mach, macl 0000000000101000 ?1? clrs 0 s 0000000001001000 ?1? clrt 0 t 0000000000001000 ?10 ldc rm,sr rm sr 0100mmmm00001110 5lsb ldc rm,gbr rm gbr 0100mmmm00011110 ?3? ldc rm,vbr rm vbr 0100mmmm00101110 3? ldc rm,ssr rm ssr 0100mmmm00111110 3? ldc rm,spc rm spc 0100mmmm01001110 3? ldc rm,r0_bank rm r0_bank 0100mmmm10001110 3? ldc rm,r1_bank rm r1_bank 0100mmmm10011110 3? ldc rm,r2_bank rm r2_bank 0100mmmm10101110 3? ldc rm,r3_bank rm r3_bank 0100mmmm10111110 3? ldc rm,r4_bank rm r4_bank 0100mmmm11001110 3? ldc rm,r5_bank rm r5_bank 0100mmmm11011110 3? ldc rm,r6_bank rm r6_bank 0100mmmm11101110 3? ldc rm,r7_bank rm r7_bank 0100mmmm11111110 3? ldc.l @rm+,sr (rm) sr, rm + 4 rm 0100mmmm00000111 7lsb ldc.l @rm+,gbr (rm) gbr, rm + 4 rm 0100mmmm00010111 ?5? ldc.l @rm+,vbr (rm) vbr, rm + 4 rm 0100mmmm00100111 5? ldc.l @rm+,ssr (rm) ssr, rm + 4 rm 0100mmmm00110111 5? ldc.l @rm+,spc (rm) spc, rm + 4 rm 0100mmmm01000111 5? ldc.l @rm+, r0_bank (rm) r0_bank, rm + 4 rm 0100mmmm10000111 5? ldc.l @rm+, r1_bank (rm) r1_bank, rm + 4 rm 0100mmmm10010111 5? ldc.l @rm+, r2_bank (rm) r2_bank, rm + 4 rm 0100mmmm10100111 5? ldc.l @rm+, r3_bank (rm) r3_bank, rm + 4 rm 0100mmmm10110111 5?
rev. 4.00, 03/04, page 42 of 660 instruction operation code privileged mode cycles t bit ldc.l @rm+, r4_bank (rm) r4_bank, rm + 4 rm 0100mmmm11000111 5? ldc.l @rm+, r5_bank (rm) r5_bank, rm + 4 rm 0100mmmm11010111 5? ldc.l @rm+, r6_bank (rm) r6_bank, rm + 4 rm 0100mmmm11100111 5? ldc.l @rm+, r7_bank (rm) r7_bank, rm + 4 rm 0100mmmm11110111 5? lds rm,mach rm mach 0100mmmm00001010 ?1? lds rm,macl rm macl 0100mmmm00011010 ?1? lds rm,pr rm pr 0100mmmm00101010 ?1? lds.l @rm+,mach (rm) mach, rm + 4 rm 0100mmmm00000110 ?1? lds.l @rm+,macl (rm) macl, rm + 4 rm 0100mmmm00010110 ?1? lds.l @rm+,pr (rm) pr, rm + 4 rm 0100mmmm00100110 ?1? ldtlb pteh/ptel tlb 0000000000111000 1? nop no operation 0000000000001001 ?1? pref @rm (rm) cache 0000mmmm10000011 ? 2? rte delayed branch, ssr/spc sr/pc 0000000000101011 4? sets 1 s 0000000001011000 ?1? sett 1 t 0000000000011000 ?11 sleep sleep 0000000000011011 4 * ? stc sr,rn sr rn 0000nnnn00000010 1? stc gbr,rn gbr rn 0000nnnn00010010 ?1? stc vbr,rn vbr rn 0000nnnn00100010 1? stc ssr,rn ssr rn 0000nnnn00110010 1? stc spc,rn spc rn 0000nnnn01000010 1? stc r0_bank,rn r0_bank rn 0000nnnn10000010 1? stc r1_bank,rn r1_bank rn 0000nnnn10010010 1? stc r2_bank,rn r2_bank rn 0000nnnn10100010 1? stc r3_bank,rn r3_bank rn 0000nnnn10110010 1?
rev. 4.00, 03/04, page 43 of 660 instruction operation code privileged mode cycles t bit stc r4_bank,rn r4_bank rn 0000nnnn11000010 1? stc r5_bank,rn r5_bank rn 0000nnnn11010010 1? stc r6_bank,rn r6_bank rn 0000nnnn11100010 1? stc r7_bank,rn r7_bank rn 0000nnnn11110010 1? stc.l sr,@ ? rn rn?4 rn, sr (rn) 0100nnnn00000011 2? stc.l gbr,@ ? rn rn?4 rn, gbr (rn) 0100nnnn00010011 ?2? stc.l vbr,@ ? rn rn?4 rn, vbr (rn) 0100nnnn00100011 2? stc.l ssr,@ ? rn rn?4 rn, ssr (rn) 0100nnnn00110011 2? stc.l spc,@ ? rn rn?4 rn, spc (rn) 0100nnnn01000011 2? stc.l r0_bank, @ ? rn rn?4 rn, r0_bank (rn) 0100nnnn10000011 2? stc.l r1_bank, @ ? rn rn?4 rn, r1_bank (rn) 0100nnnn10010011 2? stc.l r2_bank, @ ? rn rn?4 rn, r2_bank (rn) 0100nnnn10100011 2? stc.l r3_bank, @ ? rn rn?4 rn, r3_bank (rn) 0100nnnn10110011 2? stc.l r4_bank, @ ? rn rn?4 rn, r4_bank (rn) 0100nnnn11000011 2? stc.l r5_bank, @ ? rn rn?4 rn, r5_bank (rn) 0100nnnn11010011 2? stc.l r6_bank, @ ? rn rn?4 rn, r6_bank (rn) 0100nnnn11100011 2? stc.l r7_bank, @ ? rn rn?4 rn, r7_bank (rn) 0100nnnn11110011 2? sts mach,rn mach rn 0000nnnn00001010 ?1? sts macl,rn macl rn 0000nnnn00011010 ?1? sts pr,rn pr rn 0000nnnn00101010 ?1? sts.l mach,@ ? rn rn?4 rn, mach (rn) 0100nnnn00000010 ?1? sts.l macl,@ ? rn rn?4 rn, macl (rn) 0100nnnn00010010 ?1? sts.l pr,@ ? rn rn?4 rn, pr (rn) 0100nnnn00100010 ?1? trapa #imm pc spc, sr ssr, imm tra 11000011iiiiiiii ?8?
rev. 4.00, 03/04, page 44 of 660 notes: * the number of cycles until the sleep state is entered. 1. the table shows the minimum number of execution cycles. the actual number of instruction execution cycles will increase in cases such as the followings: a. when there is contention between an instruction fetch and data access b. when the destination register in a load (memory-to-register) instruction is also used by the next instruction 2. with the addressing modes using displacement (disp) listed below, the assembler descriptions in this manual show the value before scaling ( 1, 2, or 4) is performed. this is done to clarify the operation of the chip. for the actual assembler descriptions, refer to the individual assembler notation rules. @ (disp:4, rn) ; register-indirect with displacement @ (disp:8, rn) ; gbr-indirect with displacement @ (disp:8, pc) ; pc-relative with displacement disp:8, disp:12 ; pc-relative
rev. 4.00, 03/04, page 45 of 660 2.4.2 instruction code map table 2.11 shows the instruction code map. table 2.11 instruction code map instruction code fx: 0000 fx: 0001 fx: 0010 fx: 0011 to 1111 msb lsb md: 00 md: 01 md: 10 md: 11 0000 rn fx 0000 0000 rn fx 0001 0000 rn 00md 0010 stc sr,rn stc gbr,rn stc vbr,rn stc ssr,rn 0000 rn 01md 0010 stc spc,rn 0000 rn 10md 0010 stc r0_bank,rn stc r1_bank,rn stc r2_bank,rn stc r3_bank,rn 0000 rn 11md 0010 stc r4_bank,rn stc r5_bank,rn stc r6_bank,rn stc r7_bank,rn 0000 rm 00md 0011 bsrf rm braf rm 0000 rm 10md 0011 pref @rm 0000 rn rm 01md mov.b rm,@(r0,rn) mov.w rm,@(r0,rn) mov.l rm,@(r0,rn) mul.l rm,rn 0000 0000 00md 1000 clrt sett clrmac ldtlb 0000 0000 01md 1000 clrs sets 0000 0000 fx 1001 nop div0u 0000 0000 fx 1010 0000 0000 fx 1011 rts sleep rte 0000 rn fx 1000 0000 rn fx 1001 movt rn 0000 rn fx 1010 sts mach,rn sts macl,rn sts pr,rn 0000 rn fx 1011 0000 rn rm 11md mov.b @(r0,rm),rn mov.w @(r0,rm),rn mov.l @(r0,rm),rn mac.l @rm+,@rn+ 0001 rn rm disp mov.l rm,@(disp:4,rn) 0010 rn rm 00md mov.b rm,@rn mov.w rm,@rn mov.l rm,@rn 0010 rn rm 01md mov.b rm,@-rn mov.w rm,@-rn mov.l rm,@-rn div0s rm,rn 0010 rn rm 10md tst rm,rn and rm,rn xor rm,rn or rm,rn 0010 rn rm 11md cmp/str rm,rn xtrct rm,rn mulu.w rm,rn mulsw rm,rn 0011 rn rm 00md cmp/eq rm,rn cmp/hs rm,rn cmp/ge rm,rn 0011 rn rm 01md div1 rm,rn dmulu.l rm,rn cmp/hi rm,rn cmp/gt rm,rn 0011 rn rm 10md sub rm,rn subc rm,rn subv rm,rn 0011 rn rm 11md add rm,rn dmuls.l rm,rn addc rm,rn addv rm,rn
rev. 4.00, 03/04, page 46 of 660 instruction code fx: 0000 fx: 0001 fx: 0010 fx: 0011 to 1111 msb lsb md: 00 md: 01 md: 10 md: 11 0100 rn fx 0000 shll rn dt rn shal rn 0100 rn fx 0001 shlr rn cmp/pz rn shar rn 0100 rn fx 0010 sts.l mach,@-rn sts.l macl,@-rn sts.l pr,@-rn 0100 rn 00md 0011 stc.l sr,@-rn stc.l gbr,@-rn stc.l vbr,@-rn stc.l ssr,@-rn 0100 rn 01md 0011 stc.l spc,@-rn 0100 rn 10md 0011 stc.l r0_bank,@-rn stc.l r1_bank,@-rn stc.l r2_bank,@-rn stc.l r3_bank,@- rn 0100 rn 11md 0011 stc.l r4_bank,@-rn stc.l r5_bank,@-rn stc.l r6_bank,@-rn stc.l r7_bank,@- rn 0100 rn fx 0100 rotl rn rotcl rn 0100 rn fx 0101 rotr rn cmp/pl rn rotcr rn 0100 rm fx 0110 lds.l @rm+,mach lds.l @rm+,macl lds.l @rm+,pr 0100 rm 00md 0111 ldc.l @rm+,sr ldc.l @rm+,gbr ldc.l @rm+,vbr ldc.l @rm+,ssr 0100 rm 01md 0111 ldc.l @rm+,spc 0100 rm 10md 0111 ldc.l @rm+,r0_bank ldc.l @rm+,r1_bank ldc.l @rm+,r2_bank ldc.l @rm+,r3_b ank 0100 rm 11md 0111 ldc.l @rm+,r4_bank ldc.l @rm+,r5_bank ldc.l @rm+,r6_bank ldc.l @rm+,r7_b ank 0100 rn fx 1000 shll2 rn shll8 rn shll16 rn 0100 rn fx 1001 shlr2 rn shlr8 rn shlr16 rn 0100 rm fx 1010 lds rm,mach lds rm,macl lds rm,pr 0100 rm/ rn fx 1011 jsr @rm tas.b @rn jmp @rm 0100 rn rm 1100 shad rm,rn 0100 rn rm 1101 shld rm,rn 0100 rm 00md 1110 ldc rm,sr ldc rm,gbr ldc rm,vbr ldc rm,ssr 0100 rm 01md 1110 ldc rm,spc 0100 rm 10md 1110 ldc rm,r0_bank ldc rm,r1_bank ldc rm,r2_bank ldc rm,r3_bank 0100 rm 11md 1110 ldc rm,r4_bank ldc rm,r5_bank ldc rm,r6_bank ldc rm,r7_bank 0100 rn rm 1111 mac.w @rm+,@rn+ 0101 rn rm disp mov.l @(disp:4,rm),rn 0110 rn rm 00md mov.b @rm,rn mov.w @rm,rn mov.l @rm,rn mov rm,rn 0110 rn rm 01md mov.b @rm+,rn mov.w @rm+,rn mov.l @rm+,rn not rm,rn 0110 rn rm 10md swap.b rm,rn swap.w rm,rn negc rm,rn neg rm,rn 0110 rn rm 11md extu.b rm,rn extu.w rm,rn exts.b rm,rn exts.w rm,rn 0111 rn imm add #imm:8,rn
rev. 4.00, 03/04, page 47 of 660 instruction code fx: 0000 fx: 0001 fx: 0010 fx: 0011 to 1111 msb lsb md: 00 md: 01 md: 10 md: 11 1000 00md rn disp mov.b r0,@(disp:4,rn) mov.w r0,@(disp:4,rn) 1000 01md rm disp mov.b @(disp:4,rm),r0 mov.w @(disp:4,rm),r0 1000 10md imm/disp cmp/eq #imm:8,r0 bt label:8 bf label:8 1000 11md imm/disp bt/s label:8 bf/s label:8 1001 rn disp mov.w @(disp:8,pc),rn 1010 disp bra label:12 1011 disp bsr label:12 1100 00md imm/disp mov.b r0,@(disp:8,gbr) mov.w r0,@(disp:8,gbr) mov.l r0,@(disp:8,gbr) trapa #imm:8 1100 01md disp mov.b @(disp:8,gbr),r0 mov.w @(disp:8,gbr),r0 mov.l @(disp:8,gbr),r0 mova @(disp:8,pc),r0 1100 10md imm tst #imm:8,r0 and #imm:8,r0 xor #imm:8,r0 or #imm:8,r0 1100 11md imm tst.b #imm:8,@(r0,gbr) and.b #imm:8,@(r0,gbr) xor.b #imm:8,@(r0,gbr) or.b #imm:8,@(r0,gbr) 1101 rn disp mov.l @(disp:8,pc),rn 1110 rn imm mov #imm:8,rn 1111 ************ note: see the sh-3/sh-3e/sh3-dsp programming manual for details.
rev. 4.00, 03/04, page 48 of 660 2.5 processor states and processor modes 2.5.1 processor states the sh7706 has five processor states: the reset state, exception-handling state, bus-released state, program execution state, and power-down state. reset state: in this state the cpu is reset. the cpu enters the power-on reset state if the resetp pin is low, or the manual reset state if the resetm pin is low. see section 4, exception processing, for more information on resets. in the power-on reset state, the internal states of the cpu and the on-chip supporting module registers are initialized. in the manual reset state, the internal states of the cpu and registers of on- chip supporting modules other than the bus state controller (bsc) are initialized. refer to the register descriptions in the relevant sections for further details. exception-handling state: this is a transient state during which the cpu's processor state flow is altered by a reset, general exception, or interrupt exception handling. in the case of a reset, the cpu branches to address h'a0000000 and starts executing the user- coded exception handling program. in the case of a general exception or interrupt, the program counter (pc) contents are saved in the saved program counter (spc) and the status register (sr) contents are saved in the saved status register (ssr). the cpu branches to the start address of the user-coded exception service routine found from the sum of the contents of the vector base address and the vector offset. see section 4, exception processing, for more information on resets, general exceptions, and interrupts. program execution state: in this state the cpu executes program instructions in sequence. power-down state: in the power-down state, cpu operation halts and power consumption is reduced. there are three modes in the power-down state: sleep mode, software standby mode and hardware standby mode. the software standby mode and hardware standby mode are expressed by a generlc name, standby mode. see section 22, power-down modes, for more information. bus-released state: in this state the cpu has released the bus to a device that requested it. transitions between the states are shown in figure 2.6.
rev. 4.00, 03/04, page 49 of 660 from any state when resetp = 0 from any state but hardware standby mode or bus-released state when resetm = 0 note: * the hardware standby mode is entered when the ca pin goes low level from any state. resetp = 1 resetm = 1 resetp = 0 ca = 1, resetp =0 power-on reset state manual reset state program execution state bus-released state sleep mode software standby mode hardware standby mode * exception-handling state interrupt bus request bus request clearance exception interrupt end of exception transition processing bus request bus request clearance sleep instruction with stby bit set interrupt reset state power-down state sleep instruction with stby bit cleared bus request bus request clearance figure 2.6 processor state transitions
rev. 4.00, 03/04, page 50 of 660 2.5.2 processor modes there are two processor modes: privileged mode and user mode. the processor mode is determined by the processor mode bit (md) in the status register (sr). user mode is selected when the md bit is 0, and privileged mode when the md bit is 1. when the reset state or exception state is entered, the md bit is set to 1. when exception handling ends, the md bit is cleared to 0 and user mode is entered. there are certain registers and bits which can only be accessed in privileged mode.
rev. 4.00, 03/04, page 51 of 660 section 3 memory management unit (mmu) this lsi has an on-chip memory management unit (mmu) that implements address translation. this lsi's features a resident translation look-aside buffer (tlb) that caches information for user- created address translation tables located in external memory. it enables high-speed translation of virtual addresses into physical addresses. address translation uses the paging system and supports two page sizes (1 kbyte and 4 kbytes). the access right to virtual address space can be set for privileged and user modes to provide memory protection. 3.1 role of mmu the mmu is a feature designed to make efficient use of physical memory. as shown in figure 3.1, if a process is smaller in size than the physical memory, the entire process can be mapped onto physical memory. however, if the process increases in size to the extent that it no longer fits into physical memory, it becomes necessary to partition the process and to map those parts requiring execution onto memory as occasion demands (figure 3.1(1)). having the process itself consider this mapping onto physical memory would impose a large burden on the process. to lighten this burden, the idea of virtual memory was born as a means of performing en bloc mapping onto physical memory (figure 3.1(2)). in a virtual memory system, substantially more virtual memory than physical memory is provided, and the process is mapped onto this virtual memory. thus a process only has to consider operation in virtual memory. mapping from virtual memory to physical memory is handled by the mmu. the mmu is normally controlled by the operating system, switching physical memory to allow the virtual memory required by a process to be mapped onto physical memory in a smooth fashion. switching of physical memory is carried out via secondary storage, etc. the virtual memory system that came into being in this way is particularly effective in a time- sharing system (tss) in which a number of processes are running simultaneously (figure 3.1(3)). if processes running in a tss had to take mapping onto virtual memory into consideration while running, it would not be possible to increase efficiency. virtual memory is thus used to reduce this load on the individual processes and so improve efficiency (figure 3.1(4)). in the virtual memory system, virtual memory is allocated to each process. the task of the mmu is to perform efficient mapping of these virtual memory areas onto physical memory. it also has a memory protection feature that prevents one process from inadvertently accessing another process's physical memory. when address translation from virtual memory to physical memory is performed using the mmu, it may occur that the relevant translation information is not recorded in the mmu, with the result that one process may inadvertently access the virtual memory allocated to another process. in this case, the mmu will generate an exception, change the physical memory mapping, and record the new address translation information.
rev. 4.00, 03/04, page 52 of 660 although the functions of the mmu could also be implemented by software alone, the need for translation to be performed by software each time a process accesses physical memory would result in poor efficiency. for this reason, a buffer for address translation (translation look-aside buffer: tlb) is provided in hardware to hold frequently used address translation information. the tlb can be described as a cache for storing address translation information. unlike cache memory, however, if address translation fails, that is, if an exception is generated, switching of address translation information is normally performed by software. this makes it possible for memory management to be performed flexibly by software. the mmu has two methods of mapping from virtual memory to physical memory: a paging method using fixed-length address translation, and a segment method using variable-length address translation. with the paging method, the unit of translation is a fixed-size address space (usuallyof1to64kbytes)calledapage. in the following text, this lsi's address space in virtual memory is referred to as virtual address space, and address space in physical memory as physical memory space. process 1 physical memory mmu (1) (2) (3) (4) process 1 physical memory process 1 virtual memory mmu physical memory process 1 process 2 process 3 physical memory process 1 process 2 process 3 virtual memory physical memory figure 3.1 mmu functions
rev. 4.00, 03/04, page 53 of 660 3.1.1 this lsi's mmu virtual address map: this lsi uses 32-bit virtual addresses to access a 4-gbyte virtual address space that is divided into several areas. address space mapping is shown in figure 3.2. in the privileged mode, the virtual address space is divided into five areas. p0 and p3 areas are mapped to physical address spaces in page units according to the information in the address translation table. write-back or write-through can be selected for write access by means of a cache control register (ccr) setting. mapping of the p1 area is fixed to physical address space (h'00000000 to h'1fffffff). in the p1 area, setting a virtual address msbs (bit 31) to 0 generates the corresponding physical address. p1 area access can be cached, write-back or write-through can be selected according to the setting of ccr whether to cache or not. mapping of the p2 area is fixed to physical address space (h'00000000 to h'1fffffff). in the p2 area, setting the top three virtual address bits (bits 31, 30, and 29) to 0 generates the corresponding physical address. p2 area access cannot be cached. the p1 and p2 areas are not mapped by the address translation table, so the tlb is not used and no exceptions like tlb misses occur. initialization of mmu-related registers, exception processing, and the like are located in the p1 and p2 areas. because the p1 area is cached, handlers that require high-speed processing are placed there. a part of the control register in the peripheral module is allocated in p2 area. the p4 area is used for mapping on-chip control register addresses. address spaces from h'e0000000 to h'efffffff and from h'f4000000 to h'fbffffff are reserved. an operation of this lsi is not guaranteed when these address spaces are accessed. address space from h'f0000000 to h'f1ffffff is assigned to the cache, and address space from h'f2000000 to h'f3ffffff is assigned to the tlb. address space from h'fc000000 to h'ffffffff is a space for control registers. however, an operation of this lsi is not guaranteed when an address space that is not assigned to any control register is accessed. in the user mode, 2 gbytes of the virtual address space from h'00000000 to h'7fffffff (area u0) can be accessed. u0 is mapped onto physical address space in page units. write-back or write- through mode can be selected for write accesses by means of ccr setting. 2 gbytes of the virtual address space from h'80000000 to h'ffffffff cannot be accessed in the user mode. attempting to do so creates an cpu address error. write-back or write-through can be selected for write access by means of the ccr setting.
rev. 4.00, 03/04, page 54 of 660 h'80000000 h'a0000000 h'c0000000 h'e0000000 h'ffffffff 2-gbyte virtual space, cacheable (write-back/write-through) 2-gbyte virtual space, cacheable (write-back/write-through) cpu address error h'00000000 h'00000000 h'80000000 h'ffffffff area p0 area p1 area p2 area p3 area p4 area u0 privileged mode user mode 0.5-gbyte fixed physical space, cacheable (write-back/write-through) 0.5-gbyte fixed physical space, non-cacheable 0.5-gbyte virtual space, cacheable (write-back/write-through) 0.5-gbyte control space, non-cacheable figure 3.2 virtual address space mapping
rev. 4.00, 03/04, page 55 of 660 physical address space: this lsi supports a 32-bit physical address space, but the upper 3 bits are actually ignored and treated as a shadow. see section 8, bus state controller (bsc), for details. address translation: when the mmu is enabled, the virtual address space is divided into units called pages. physical addresses are translated in page units. address translation tables in external memory hold information such as the physical address that corresponds to the virtual address and memory protection codes. when an access to areas p1 or p2 occurs, there is no tlb access and the physical address is defined uniquely by hardware. if it belongs to area p0, p3 or u0, the tlb is searched by virtual address and, if that virtual address is registered in the tlb, the access hits the tlb. the corresponding physical address and the page control information are read from the tlb and the physical address is determined. if the virtual address is not registered in the tlb, a tlb miss exception occurs and processing will shift to the tlb miss handler. in the tlb miss handler, the tlb address translation table in external memory is searched and the corresponding physical address and the page control information are registered in the tlb. after returning from the handler, the instruction that caused the tlb miss is re-executed. when the mmu is enabled, address translation information that results in a physical address space of h'80000000 to h'ffffffff should not be registered in the tlb. when the mmu is disabled, the virtual address is used directly as the physical address. as this lsi supports a 29-bit address space as the physical address space, the top 3 bits of the physical address are ignored, and constitute a shadow space. for example, addresses h'00001000 in the p0 area, h'80001000 in the p1 area, h'a0001000 in the p2 area, and h'c0001000 in the p3 area are all mapped onto the same physical address. when access to these addresses is performed with the cache enabled, an address with the top 3 bits of the physical address masked to 0 is stored in the cache address array to ensure data congruity. single virtual memory mode and multiple virtual memory mode: there are two virtual memory modes: single virtual memory mode and multiple virtual memory mode. in single virtual memory mode, multiple processes run in parallel using the virtual address space exclusively and the physical address corresponding to a given virtual address is specified uniquely. in multiple virtual memory mode, multiple processes run in parallel sharing the virtual address space, so a given virtual address may be translated into different physical addresses depending on the process. by the value set to the mmu control register (mmucr), either single or multiple virtual mode is selected. in terms of operation, the only difference between single virtual memory mode and multiple virtual memory mode is the tlb address comparison method.
rev. 4.00, 03/04, page 56 of 660 address space identifier (asid): in multiple virtual memory mode, the address space identifier (asid) is used to differentiate between processes running in parallel and sharing virtual address space. the asid is 8 bits in length and can be set by software setting of the asid of the currently running process in page table entry register high (pteh) within the mmu. when the process is switched using the asid, the tlb does not have to be purged. in single virtual memory mode, the asid is used to provide memory protection for processes running simulataneously and using the virtual address space exclusively. 3.2 register description there are five registers for mmu processing. these are located in address space area p4 and can only be accessed from privileged mode by specifying the address. these registers for mmu processing are shown below. refer to section 23, list of registers, for more details of the addresses and access sizes. ? page table entry register high (pteh) ? page table entry register low (ptel) ? translation table base register (ttb) ? tlb exception address register (tea) ? mmu control register (mmucr) 3.2.1 page table entry register high (pteh) the page table entry register high (pteh) consists of a virtual page number (vpn) and asid. the vpn is set the vpn of the virtual address at which the exception is generated in case of an mmu exception or cpu address error exception. when the page size is 4 kbytes, the vpn is the upper 20 bits of the virtual address, but in this case the upper 22 bits of the virtual address are set. the vpn can also be modified by software. as the asid, software sets the number of the currently executing process. the vpn and asid are recorded in the tlb by the ldtlb instruction. bit bit name initial value r/w description 31 to 10 vpn ? r/w virtual page number 9, 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7to0 asid ? r/w address space identifier
rev. 4.00, 03/04, page 57 of 660 3.2.2 page table entry register low (ptel) the page table entry register low register (ptel) is used to store the physical page number and page management information to be recorded in the tlb by the ldtlb instruction. the contents of this register are only modified by a software command. bit bit name initial value r/w description 31 to 10 ppn ? r/w physical page number 9 8 7 6, 5 4 3 2 1 0 ? v ? pr sz c d sh ? 0 ? 0 ? ? ? ? ? 0 r r/w r r/w r/w r/w r/w r/w r page management information refer to section 3.3 tlb functions. 3.2.3 the translation table base register (ttb) the translation table base register (ttb) is a 32-bit register. ttb is used to store the base address of the current page table. the contents of this register are only modified in response to a software command. ttb is available to use by software for general purposes. 3.2.4 the tlb exception address register (tea) the tlb exception address register (tea) is a 32-bit register. tea is used to store the virtual address corresponding to a mmu or cpu address error exception after these exceptions has occurred. this value remains valid until the next exception or interrupt occurs.
rev. 4.00, 03/04, page 58 of 660 3.2.5 mmu control register (mmucr) the mmu control register (mmucr) makes the mmu settings. any program that modifies mmucr should reside in the p1 or p2 area. bit bit name initial value r/w description 31 to 9 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 8sv ? r/w single virtual memory mode 0: multiple virtual memory mode 1: single virtual memory mode 7, 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5, 4 rc all 0 r/w random counter a 2-bit random counter, automatically updated by hardware according to the following rules in the event of an mmu exception. when a tlb miss exception occurs, all tlb entry ways corresponding to the virtual address at which the exception occurred are checked, and if all ways are valid, 1 is added to ro; if there is one or more invalid ways, they are set by priority from way 0, in the order: way 0, way 1, way 2, way 3. in the event of an mmu exception other than a tlb miss exception, the way which caused the exception is set in rc. 3 ? 0rreserved this bit is always read as 0. the write value should always be 0. 2 tf 0 r/w tlb flush when 1 is set, all valid bits of tlb are cleared to 0 (flush). this bit is always reads as 0. 1 ix 0 r/w index mode when 0, vpn bits 16 to 12 are used as the tlb index number. when 1, the value obtained by ex-oring asid bits 4 to 0 in pteh and vpn bits 16 to 12 are used as the tlb index number. 0 at 0 r/w address translation enables (valid) or disables (invalid) the mmu. 0: mmu disabled 1: mmu enabled
rev. 4.00, 03/04, page 59 of 660 3.3 tlb functions 3.3.1 configuration of the tlb the tlb caches address translation table information located in the external memory. the address translation table stores the physical page number translated from the virtual page number and the control information for the page, which is the unit of address translation. figure 3.3 shows the overall tlb configuration. the tlb is 4-way set associative with 128 entries. there are 32 entries for each way. figure 3.4 shows the configuration of virtual addresses and tlb entries. entry 1 address array data array entry 0 entry 1 entry 31 ways 0 to 3 ways 0 to 3 vpn(11?10) vpn(31?17) asid(7?0) v entry 0 entry 31 ppn(31?10) pr(1?0) sz c d sh figure 3.3 overall configuration of the tlb
rev. 4.00, 03/04, page 60 of 660 31 9 vpn virtual address (1-kbyte page) virtual address (4-kbyte page) tlb entry offset vpn vpn (31 ? 17) vpn (11 ? 10) asid v ppn c d offset 0 10 31 11 0 (15) (2) pr (2) (22) (8) (1) (1) (1) sh (1) sz (1) 12 vpn: virtual page number. top 22 bits of virtual address for a 1-kbyte page, or top 20 bits of virtual address for a 4-kbyte page. since vpn bits 16-12 are used as the index number, they are not stored in the tlb entry. asid: address space identifier. indicates the process that can access a virtual page. in single virtual memory mode and user mode, or in multiple virtual memory mode, if the sh bit is 0, the address is compared with the asid in pteh when address comparison is performed. sh: share status bit 0 = page not shared between processes 1 = page shared between processes sz: page-size bit 0 = 1-kbyte page 1 = 4-kbyte page v: valid bit. indicates whether entry is valid. 0 = invalid 1 = valid cleared to 0 by a power-on reset. not affected by a manual reset. ppn: physical page number. top 22 bits of physical address. ppn bits 11-10 are not used in case of a 4-kbyte page. attention must be paid to the synonym problem in case of a 1- kbyte page (see section 3.4.4 avoiding synonym problems). pr: set the most significant bit to 0. protection key field. 2-bit field encoded to define the access rights to the page. 00: reading only is possible in privileged mode. 01: reading/writing is possible in privileged mode. 10: reading only is possible in privileged/user mode. 11: reading/writing is possible in privileged/user mode. c: cacheable bit. indicates whether the page is cacheable. 0: non-cacheable 1: cacheable d: dirty bit. indicates whether the page has been written to. 0 = not written to 1 = written to legend figure 3.4 virtual address and tlb structure
rev. 4.00, 03/04, page 61 of 660 3.3.2 tlb indexing the tlb uses a 4-way set associative scheme, so entries must be selected by index. vpn bits 16 to 12 and asid bits in pteh 4 to 0 are used as the index number regardless of the page size. the index number can be generated in two different ways depending on the setting of the ix bit in mmucr. 1. when ix = 0, vpn bits 16 to 12 alone are used as the index number 2. when ix = 1, vpn bits 16 to 12 are ex-ored with asid bits 4 to 0 to generate a 5-bit index number the second method is used to prevent lowered tlb efficiency that results when multiple processes run simultaneously in the same virtual address space (multiple virtual memory) and a specific entry is selected by indexing of each process. figures 3.5 and 3.6 show the indexing schemes. 31 16 11 12 17 0 31 0 pteh register virtual address vpn 0 asid 7 10 index asid(4 to 0) exclusive-or ways 0 to 3 vpn(31?17) vpn(11?10) asid(7?0) v 0 31 address array data array ppn(3?0) pr(1?0) sz c d sh figure 3.5 tlb indexing (ix = 1) 31 16 11 12 17 0 virtual address ways 0 to 3 vpn(31 ? 17) vpn(11 ? 10) asid(7 ? 0) v 0 address array data array ppn(31 ? 10) pr(1 ? 0) sz c d sh index 31 figure 3.6 tlb indexing (ix = 0)
rev. 4.00, 03/04, page 62 of 660 3.3.3 tlb address comparison the results of address comparison determine whether a specific virtual page number is registered in the tlb. the virtual page number of the virtual address that accesses external memory is compared to the virtual page number of the indexed tlb entry. the asid within the pteh is compared to the asid of the indexed tlb entry. all four ways are searched simultaneously. if the compared values match, and the indexed tlb entry is valid (v bit = 1), the hit is registered. it is necessary to have software ensure that tlb hits do not occur simultaneously in more than one way, as hardware operation is not guaranteed if this occurs. for example, if there are two identical tlb entries with the same vpn and a setting is made such that a tlb hit is made only by a process with asid = h'ff when one is in the shared state (sh = 1) and the other in the non-shared state (sh = 0), then if the asid in pteh is set to h'ff, there is a possibility of simultaneous tlb hits in both these ways. it is therefore necessary to ensure that this kind of setting is not made by software. the object compared varies depending on the page management information (sz, sh) in the tlb entry. it also varies depending on whether the system supports multiple virtual memory or single virtual memory. the page-size information determines whether vpn (11, 10) is compared. vpn (11, 10) is compared for 1-kbyte pages (sz = 0) but not for 4-kbyte pages (sz = 1). the sharing information (sh) determines whether the pteh.asid and the asid in the tlb entry are compared. asids are compared when there is no sharing between processes (sh = 0) but not when there is sharing (sh = 1). when single virtual memory is supported (mmucr.sv = 1) and privileged mode is engaged (sr.md = 1), all process resources can be accessed. this means that asids are not compared when single virtual memory is supported and privileged mode is engaged. the objects of address comparison are shown in figure 3.7.
rev. 4.00, 03/04, page 63 of 660 bits compared: vpn (31 to 17) vpn (11 to 10) sz = 0? yes no yes (1 kbyte) no (4 kbytes) bits compared: vpn (31 to 17) bits compared: vpn (31 to 17) vpn (11 to 10) asid (7 to 0) sz = 0? yes (1 kbyte) no (4 kbytes) bits compared: vpn (31 to 17) asid (7 to 0) sh = 1 or (sr.md = 1 and mmucr.sv = 1)? figure 3.7 objects of address comparison
rev. 4.00, 03/04, page 64 of 660 3.3.4 page management information in addition to the sh and sz bits, the page management information of tlb entries also includes d, c, and pr bits. the d bit of a tlb entry indicates whether the page is dirty (i.e., has been written to). if the d bit is 0, an attempt to write to the page results in an initial page write exception. for physical page swapping between secondary memory and main memory, for example, pages are controlled so that a dirty page is paged out of main memory only after that page is written back to secondary memory. to record that there has been a write to a given page in the address translation table in memory, an initial page write exception is used. the c bit in the entry indicates whether the referenced page resides in a cacheable or non- cacheable area of memory. the pr field specifies the access rights for the page in privileged and user modes and is used to protect memory. attempts at nonpermitted accesses result in tlb protection violation exceptions. access states designated by the d, c, and pr bits are shown in table 3.1. table 3.1 access states designated by d, c, and pr bits privileged mode user mode reading writing reading writing 0 permitted initial page write exception permitted initial page write exception dbit 1 permitted permitted permitted permitted 0 permitted (no caching) permitted (no caching) permitted (no caching) permitted (no caching) cbit 1 permitted (with caching) permitted (with caching) permitted (with caching) permitted (with caching) 00 permitted tlb protection violation exception tlb protection violation exception tlb protection violation exception 01 permitted permitted tlb protection violation exception tlb protection violation exception 10 permitted tlb protection violation exception permitted tlb protection violation exception pr bit 11 permitted permitted permitted permitted
rev. 4.00, 03/04, page 65 of 660 3.4 mmu functions 3.4.1 mmu hardware management there are two kinds of mmu hardware management as follows: 1. the mmu decodes the virtual address accessed by a process and performs address translation by controlling the tlb in accordance with the mmucr settings. 2. in address translation, the mmu receives page management information from the tlb, and determines the mmu exception and whether the cache is to be accessed (using the c bit). for details of the determination method and the hardware processing, see section 3.5, mmu exceptions. 3.4.2 mmu software management there are three kinds of mmu software management, as follows. 1. mmu register setting. mmucr setting, in particular, should be performed in areas p1 and p2 for which address translation is not performed. also, since sv and ix bit changes constitute address translation system changes, in this case, tlb flushing should be performed by simultaneously writing 1 to the tf bit also. since mmu exceptions are not generated in the mmu disabled state with the at bit cleared to 0, use in the disabled state must be avoided with software that does not use the mmu. 2. tlb entry recording, deletion, and reading. tlb entry recording can be done in two ways by using the ldtlb instruction, or by writing directly to the memory-mapped tlb. for tlb entry deletion and reading, the memory allocation tlb can be accessed. see section 3.4.3, mmu instruction (ldtlb), for details of the ldtlb instruction, and section 3.6, configuration of the memory-mapped tlb, for details of the memory-mapped tlb. 3. mmu exception processing. when an mmu exception is generated, it is handled on the basis of information set from the hardware side. see section 3.5, mmu exceptions, for details. when single virtual memory mode is used, it is possible to create a state in which physical memory access is enabled in the privileged mode only by clearing the share status bit (sh) to 0 to specify recording of all tlb entries. this strengthens inter-process memory protection, and enables special access levels to be created in the privileged mode only. recording a 1-kbyte page tlb entry may result in a synonym problem. see section 3.4.4, avoiding synonym problems.
rev. 4.00, 03/04, page 66 of 660 3.4.3 mmu instruction (ldtlb) the load tlb instruction (ldtlb) is used to record tlb entries. when the ix bit in mmucr is 0, the ldtlb instruction changes the tlb entry in the way specified by the rc bit in mmucr to the value specified by pteh and ptel, using vpn bits 16 to 12 specified in pteh as the index number. when the ix bit in mmucr is 1, the ex-or of vpn bits 16 to 12 specified in pteh and asid bits 4 to 0 in pteh are used as the index number. figure 3.8 shows the case where the ix bit in mmucr is 0. when an mmu exception occurs, the virtual page number of the virtual address that caused the exception is set in pteh by hardware. the way is set in the rc bit of mmucr for each exception according to the rules described in section 3.2.5 mmu control register (mmucr). consequently, if the ldtlb instruction is issued after setting only ptel in the mmu exception processing routine, tlb entry recording is possible. any tlb entry can be updated by software rewriting of pteh and the rc bits in mmucr. as the ldtlb instruction changes address translation information, there is a risk of destroying address translation information if this instruction is issued in the p0, u0, or p3 area. make sure, therefore, that this instruction is issued in the p1 or p2 area. also, an instruction associated with an access to the p0, u0, or p3 area (such as the rte instruction) should be issued at least two instructions after the ldtlb instruction. vpn(31 to17) vpn(11 to 10) asid(7 to 0) v vpn 0 asid vpn 0 sv 0 0 rc 0 tf ix at ppn 0 v 0 pr sz c d sh 0 write ppn(31 to 10) pr(1 to 0) sz c d sh write data array address array way selection ways 0 to 3 31 9 0 mmucr index 31 17 12 10 8 0 pteh register 31 10 0 ptel register 0 31 figure 3.8 operation of ldtlb instruction
rev. 4.00, 03/04, page 67 of 660 3.4.4 avoiding synonym problems when a 1-kbyte page is recorded in a tlb entry, a synonym problem may arise. if a number of virtual addresses are mapped onto a single physical address, the same physical address data will be recorded in a number of cache entries, and it will not be possible to guarantee data congruity. the reason why this problem only occurs when using a 1-kbyte page is explained below with reference to figure 3.9. to achieve high-speed operation of the sh7706 cache, an index number is created using virtual address bits 11 to 4. when a 4-kbyte page is used, virtual address bits 11 to 4 are included in the offset, and since they are not subject to address translation, they are the same as physical address bits 11 to 4. in cache-based address comparison and recording in the address array, since the cache tag address is a physical address, physical address bits 31 to 10 are recorded. when a 1-kbyte page is used, also, a cache index number is created using virtual address bits 11 to 4. however, in case of a 1-kbyte page, virtual address bits (11, 10) are subject to address translation and therefore may not be the same as physical address bits 11 and 10. consequently, the physical address is recorded in a different entry from that of the index number indicated by the physical address in the cache address array. for example, assume that, with 1-kbyte page tlb entries, tlb entries for which the following translation has been performed are recorded in two tlbs: virtual address 1 h'00000000 physical address h'00000c00 virtual address 2 h'00000c00 physical address h'00000c00 virtual address 1 is recorded in cache entry h'00, and virtual address 2 in cache entry h'c0. since two virtual addresses are recorded in different cache entries despite the fact that the physical addresses are the same, memory inconsistency will occur as soon as a write is performed to either virtual address. therefore, when recording a 1-kbyte tlb entry, if the physical address is the same as a physical address already used in another tlb entry, it should be recorded in such a way that physical address bits (11, 10) are the same.
rev. 4.00, 03/04, page 68 of 660 when using a 4-kbyte page virtual address 31 vpn 0 12 11 10 offset physical address 31 ppn 0 offset virtual address (11 to 4) physical address (31 to 10) cache address array when using a 1-kbyte page virtual address 31 vpn 0 10 11 offset physical address 31 ppn 0 10 11 offset virtual address (11 to 4) physical address (31 to 10) cache address array 9 9 12 11 10 figure 3.9 synonym problem
rev. 4.00, 03/04, page 69 of 660 3.5 mmu exceptions there are four mmu exceptions: tlb miss, tlb protection violation, tlb invalid, and initial page write. 3.5.1 tlb miss exception a tlb miss results when the virtual address and the address array of the selected tlb entry are compared and no match is found. tlb miss exception processing includes both hardware and software operations. hardware operations: in a tlb miss, this lsi's hardware executes a set of prescribed operations, as follows: 1. the vpn field of the virtual address causing the exception is written to the pteh register. 2. the virtual address causing the exception is written to the tea register. 3. either exception code h'040 for a load access, or h'060 for a store access, is written to the expevt register. 4. the pc value indicating the address of the instruction in which the exception occurred is written to the save program counter (spc). if the exception occurred in a delay slot, the pc value indicating the address of the related delayed branch instruction is written to the spc. 5. the contents of the status register (sr) at the time of the exception are written to the save status register (ssr). 6. the mode (md) bit in sr is set to 1, and switched to the privileged mode. 7. the block (bl) bit in sr is set to 1 to mask any further exception requests. 8. the register bank (rb) bit in sr is set to 1. 9. the rc field in the mmucr is incremented by 1 when all entries indexed are valid. when some entries indexed are invalid, the smallest way number of them is set in rc. 10. execution branches to the address obtained by adding the value of the vbr contents and h'00000400 to invoke the user-written tlb miss exception handler.
rev. 4.00, 03/04, page 70 of 660 software (tlb miss handler) operations: the software searches the page tables in external memory and allocates the required page table entry. upon retrieving the required page table entry, software must execute the following operations: 1. write the value of the physical page number (ppn) field and the protection key (pr), page size (sz), cacheable (c), dirty (d), share status (sh), and valid (v) bits of the page table entry recorded in the address translation table in the external memory into the ptel register in this lsi. 2. if using software for way selection for entry replacement, write the desired value to the rc field in mmucr. 3. issue the ldtlb instruction to load the contents of pteh and ptel into the tlb. 4. issue the return from exception handler (rte) instruction to terminate the handler routine and return to the instruction stream. 3.5.2 tlb protection violation exception a tlb protection violation exception results when the virtual address and the address array of the selected tlb entry are compared and a valid entry is found to match, but the type of access is not permitted by the access rights specified in the pr field. tlb protection violation exception processing includes both hardware and software operations. hardware operations: in a tlb protection violation exception, this lsi's hardware executes a set of prescribed operations, as follows: 1. the vpn field of the virtual address causing the exception is written to the pteh register. 2. the virtual address causing the exception is written to the tea register. 3. either exception code h'0a0 for a load access, or h'0c0 for a store access, is written to the expevt register. 4. the pc value indicating the address of the instruction in which the exception occurred is written into spc (if the exception occurred in a delay slot, the pc value indicating the address of the related delayed branch instruction is written into spc). 5. the contents of sr at the time of the exception are written to ssr. 6. the md bit in sr is set to 1, and switched to the privileged mode. 7. the bl bit in sr is set to 1 to mask any further exception requests. 8. the rb bit in sr is set to 1. 9. the way that generated the exception is set in the rc field in mmucr. 10. execution branches to the address obtained by adding the value of the vbr contents and h'00000100 to invoke the tlb protection violation exception handler.
rev. 4.00, 03/04, page 71 of 660 software (tlb protection violation handler) operations: software resolves the tlb protection violation and issues the rte (return from exception handler) instruction to terminate the handler and return to the instruction stream. note that the rte instruction should be issued after the two instructions following the ldtlb instruction. 3.5.3 tlb invalid exception a tlb invalid exception results when the virtual address is compared to a selected tlb entry address array and a match is found but the entry is not valid (the v bit is 0). tlb invalid exception processing includes both hardware and software operations. hardware operations: in a tlb invalid exception, this lsi's hardware executes a set of prescribed operations, as follows: 1. the vpn number of the virtual address causing the exception is written to the pteh register. 2. the virtual address causing the exception is written to the tea register. 3. the way number causing the exception is written to rc in mmucr. 4. either exception code h'040 for a load access, or h'060 for a store access, is written to the expevt register. 5. the pc value indicating the address of the instruction in which the exception occurred is written to the spc. if the exception occurred in a delay slot, the pc value indicating the address of the delayed branch instruction is written to the spc. 6. the contents of sr at the time of the exception are written into ssr. 7. the md bit in sr is set to 1, and switched to the privileged mode. 8. the bl bit in sr is set to 1 to mask any further exception requests. 9. the rb bit in sr is set to 1. 10. execution branches to the address obtained by adding the value of the vbr contents and h'00000100, and the tlb protection violation exception handler starts. software (tlb invalid exception handler) operations: the software searches the page tables in external memory and assigns the required page table entry. upon retrieving the required page table entry, software must execute the following operations: 1. write the values of the ppn, pr, sz, c, d, sh, and v of the page table entry recorded in the external memory to the ptel register. 2. if using software for way selection for entry replacement, write the desired value to the rc field in mmucr. 3. issue the ldtlb instruction to load the contents of pteh and ptel into the tlb. 4. issue the rte instruction to terminate the handler and return to the instruction stream. the rte instruction should be issued after two ldtlb instructions.
rev. 4.00, 03/04, page 72 of 660 3.5.4 initial page write exception an initial page write exception results in a write access when the virtual address and the address array of the selected tlb entry are compared and a valid entry with the appropriate access rights is found to match, but the d (dirty) bit of the entry is 0 (the page has not been written to). initial page write exception processing includes both hardware and software operations. hardware operations: in an initial page write exception, this lsi's hardware executes a set of prescribed operations, as follows: 1. the vpn field of the virtual address causing the exception is written to the pteh register. 2. the virtual address causing the exception is written to the tea register. 3. exception code h'080 is written to the expevt register. 4. the pc value indicating the address of the instruction in which the exception occurred is written to the spc. if the exception occurred in a delay slot, the pc value indicating the address of the related delayed branch instruction is written to the spc. 5. the contents of sr at the time of the exception are written to ssr. 6. the md bit in sr is set to 1, and switched to the privileged mode. 7. the bl bit in sr is set to 1 to mask any further exception requests. 8. the rb bit in sr is set to 1. 9. the way that caused the exception is set in the rc field in mmucr. 10. execution branches to the address obtained by adding the value of the vbr contents and h'00000100 to invoke the user-written initial page write exception handler. software (initial page write handler) operations: the software must execute the following operations: 1. retrieve the required page table entry from external memory. 2. set the d bit of the page table entry in the external memory to 1. 3. write the value of the ppn field and the pr, sz, c, d, sh, and v bits of the page table entry in the external memory to the ptel register. 4. if using software for way selection for entry replacement, write the desired value to the rc field in mmucr. 5. issue the ldtlb instruction to load the contents of pteh and ptel into the tlb. 6. issue the rte instruction to terminate the handler and return to the instruction stream. the rte instruction should be issued after two ldtlb instructions. figure 3.10 shows the flowchart for mmu exceptions.
rev. 4.00, 03/04, page 73 of 660 start tlb miss exception initial page write exception pr check pr check ye s sh = 0 and (mmucr.sv = 0 or sr.md = 0)? vpns and asids match? vpns match? no ye s ye s ye s ye s user or privileged? d = 1? c = 1? v = 1? no no user mode privileged mode no no tlb protection violation exception tlb protection violation cache access w 00/01 10 01/11 00/10 11 ww w rr rr r/w? r/w? r/w? r/w? tlb invalid exception memory access no (noncacheable) yes (cacheable) figure 3.10 mmu exception generation flowchart
rev. 4.00, 03/04, page 74 of 660 3.5.5 processing flow in event of mmu exception (same processing flow for cpu address error) figure 3.11 shows the mmu exception signals in the instruction fetch mode. id ex ma wb id ex ma wb id ex ma wb nop nop if id ex ma wb : exception source stage if id ex ma wb nop mmu exception handler handler transition processing = instruction fetch = instruction decode = instruction execution = memory access = write back = no operation if figure 3.11 mmu exception signals in instruction fetch
rev. 4.00, 03/04, page 75 of 660 figure 3.12 shows the mmu exception signals in the data access mode. if id ex if id ex if id id ex ma wb id ex ma wb id ex ma wb nop nop if id ex ma wb : exception source stage : stage cancellation for instruction that has begun execution if id ex ma wb nop = instruction fetch = instruction decode = instruction execution = memory access = write back = no operation mmu exception handler handler transition processing ma wb ma wb ex ma wb figure 3.12 mmu exception signals in data access
rev. 4.00, 03/04, page 76 of 660 3.6 configuration of the memory-mapped tlb in order for tlb operations to be managed by software, tlb contents can be read or written to in the privileged mode using the mov instruction. the tlb is assigned to the p4 area in the virtual address space. the tlb address array (vpn, v bit, and asid) is assigned to h'f2000000 to h'f2ffffff, and the data array (ppn, pr, sz, c, d, and sh bits) to h'f3000000 to h'f3ffffff. the v bit in the address array can also be accessed from the data array. only longword access is possible for both the address array and the data array. 3.6.1 address array the address array is assigned to h'f2000000 to h'f2ffffff. to access an address array, the 32-bit address field (for read/write operations) and 32-bit data field (for write operations) must be specified. the address field specifies information for selecting the entry to be accessed; the data field specifies the vpn, v bit and asid to be written to the address array (figure 3.13 (1)). in the address field, specify the entry address for selecting the entry (bits 16 to 12), w for selecting the way (bits 9, 8: 00 is way 0, 01 is way 1, 10 is way 2, 11 is way 3) and h'f2 to indicate address array access (bits 31 to 24). the ix bit in mmucr indicates whether an ex-or is taken of the entry address and asid. when writing, the write is performed to the entry selected with the index address and way. when reading, the vpn, v bit, and asid of the entry selected with the index address and way in the format of the data field in figure 3.13 without comparing addresses. 0 is written to data field bits 16 to 12. to invalidate a specific entry, specify the entry and way, and write 0 to the corresponding v bit. 3.6.2 data array the data array is assigned to h'f3000000 to h'f3ffffff. to access a data array, the 32-bit address field (for read/write operations), and 32-bit data field (for write operations) must be specified. these are specified in the general register. the address section specifies information for selecting the entry to be accessed; the data section specifies the longword data to be written to the data array (figure 3.13 (2)). in the address section, specify the entry address for selecting the entry (bits 16 to 12), w for selecting the way (bits 9, 8: 00 is way 0, 01 is way 1, 10 is way 2, 11 is way 3), and h'f3 to indicate data array access (bits 31 to 24). the ix bit in mmucr indicates whether an ex-or is taken of the entry address and asid. both reading and writing use the longword of the data array specified by the entry address and way number. the access size of the data array is fixed at longword.
rev. 4.00, 03/04, page 77 of 660 vpn 31 23 11110010 * * 16 (1) tlb address array access read access w 0 * vpn * 31 23 24 24 17 17 17 11110010 * ** * 16 write access read/write access w 60 * * 0 vpn 31 23 24 11110011 000 * * 16 17 address field w 0 * * 31 29 28 data field 10 ppn 8 976543210 x v xx vpn 31 16 data field (2) tlb data array access 12 10 11 8 97 12 10 11 8 97 12 10 11 8 97 12 10 11 8 97 6 * 0 0 asid 0v vpn 0 0 17 vpn 16 12 10 11 vpn 31 asid 8 97 0 * v d c sh pr sz vpn: v: w: virtual page number valid bit way (00: way 0, 01: way 1, 10: way 2, 11: way 3) asid: : address space identifier don't care ppn: pr: c: sh: vpn: x: w: legend legend physical page number protection key field cacheable bit share status bit virtual page number 0 for read, don't care bit for write way (00: way 0, 01: way 1, 10: way 2, 11: way 3) v: sz: d: : valid bit page-size bit dirty bit don't care address field data field address field * * * * * * * figure 3.13 specifying address and data for memory-mapped tlb access
rev. 4.00, 03/04, page 78 of 660 3.6.3 usage examples invalidating specific entries: specific tlb entries can be invalidated by writing 0 to the entry's v bit. r0 specifies the write data and r1 specifies the address. ; r0=h'1547 381c r1=h'f201 3000 ; mmucr.ix=0 ; vpn(31?17)=b'000 1010 1010 0011 vpn(11?10)=b'10 asid=b'0001 1100 ; corresponding entry association is made from the entry selected by ; the vpn(16?12)=b'1 0011 index, the v bit of the hit way is cleared to ; 0,achieving invalidation. mov.l r0,@r1 reading the data of a specific entry: this example reads the data section of a specific tlb entry. the bit order indicated in the data field in figure 3.14 (2) is read. r0 specifies the address and the data section of a selected entry is read to r1. ;r0 = 3.7 usage note 3.7.1 use of instructions manipulating md and bl bits in sr instructions that manipulate the md or bl bit in register sr (the ldc rm, sr instruction, ldc @rm+, sr instruction, and rte instruction) and the following instruction, or the ldtlb instruction, should be used with the tlb disabled or in a fixed physical address space (the p1 or p2 space).
rev. 4.00, 03/04, page 79 of 660 3.7.2 use of tlb an erroneous value is set in the rc bit in mmucr when all of the following conditions are satisfied. 1. mmu is on (at bit in mmucr is 1) 2. same vpn exists in more than one ways in a single entry in a tlb address array 3. tlb exception is generated vpn is not initialized by a power-on reset or a manual reset. therefore, two or more vpns have the same values in a single entry. when an entry in this state is registered to way 3, for example, the state of that entry in the tlb address array becomes as shown below. as a result, the same vpn exists in both way 0 and way 3, and condition 2 above is satisfied. after reset after registered to way 3 way vpn v way vpn v 0 12345 0 0 12345 0 3 12345 0 3 12345 1 a condition may also be satisfied when the tlb is handled by software. for example, if an entry in the tlb address array is registered to way 3 after way 0 is disabled (v bit is changed from 1 to 0), the state of that entry becomes as shown below. similar to the above case, the same vpn exists in both way 0 and way 3, and condition 2 above is satisfied. after way 0 is disabled after registered to way 3 way vpn v way vpn v 0 12345 0 0 12345 0 3 11111 0 3 12345 1 to avoid this failure, take the following two countermeasures. 1. after a reset, initialize the upper four bits in vpn to 1 for all entries in the tlb address array until the at bit in mmucr is set to 1. 2. when disabling a way in the tlb address array, in addition to clearing the v bit to 0, initialize the upper four bits in vpn to 1. these countermeasures will prevent vpn from being a target of address translation. accordingly, condition 3 is not satisfied, and this failure can be avoided.
rev. 4.00, 03/04, page 80 of 660
rev. 4.00, 03/04, page 81 of 660 section 4 exception processing 4.1 exception processing function exception processing is separate from normal program processing, and is performed by a routine separate from the normal program. in response to an exception processing request due to abnormal termination of the executing instruction, control is passed to a user-written exception handler. however, in response to an interrupt request, normal program execution continues until the end of the executing instruction. here, all exceptions other than resets and interrupts will be called general exceptions. there are thus three types of exceptions: resets, general exceptions, and interrupts. 4.1.1 exception processing flow in exception processing, the contents of the program counter (pc) and status register (sr) are saved in the saved program counter (spc) and saved status register (ssr), respectively, and execution of the exception handler is invoked from a vector address. the return from exception handler (rte) instruction is issued by the exception handler routine at the completion of the routine, restoring the contents of the pc and sr to return to the processor state at the point of interruption and the address where the exception occurred. a basic exception processing sequence consists of the following operations: 1. the contents of the pc and sr are saved in the spc and ssr, respectively. 2. the block (bl) bit in sr is set to 1, masking any subsequent exceptions. 3. the mode (md) bit in sr is set to 1 to place the sh7706 in the privileged mode. 4. the register bank (rb) bit in sr is set to 1. 5. an exception code identifying the exception event is written to bits 11 to 0 of the exception event (expevt) or interrupt event (intevt and intevt2) register. 6. instruction execution jumps to the designated exception processing vector address to invoke the handler routine.
rev. 4.00, 03/04, page 82 of 660 4.1.2 exception processing vector addresses the reset vector address is fixed at h'a0000000. the other three events are assigned offsets from the vector base address by software. translation look-aside buffer (tlb) miss exceptions have an offset from the vector base address of h'00000400. the vector address offset for general exception events other than tlb miss exceptions is h'00000100. the interrupt vector address offset is h'00000600. the vector base address is loaded into the vector base register (vbr) by software. the vector base address should reside in p1 or p2 fixed physical address space. figure 4.1 shows the relationship between the vector base address, the vector offset, and the vector table. vbr (vector base address) + vector offset h'a000 0000 vector address figure 4.1 vector addresses in table 4.1, exceptions and their vector addresses are listed by exception type, instruction completion state, relative acceptance priority, relative order of occurrence within an instruction execution sequence and vector address for exceptions and their vector addresses. table 4.1 exception event vectors exception type current instruction exception event priority * 1 exception order vector address vector offset power-on 1 ? h'a00000000 ? manual reset 1 ? h'a00000000 ? reset aborted h-udi reset 1 ? h'a00000000 ? cpu address error (instruction access) 2 1 ? h'00000100 general exception events aborted and retried tlb miss (instruction access) 2 2 ? h'00000400 tlb invalid (instruction access) 2 3 ? h'00000100
rev. 4.00, 03/04, page 83 of 660 exception type current instruction exception event priority * 1 exception order vector address vector offset tlb protection violation (instruction access) 2 4 ? h'00000100 general illegal instruction exception 2 5 ? h'00000100 illegal slot instruction exception 2 5 ? h'00000100 cpu address error (data access) 2 6 ? h'00000100 tlb miss (data access not in repeat loop) 2 7 ? h'00000400 tlb invalid (data access) 2 8 ? h'00000100 tlb protection violation (data access) 2 9 ? h'00000100 aborted and retried initial page write 2 10 ? h'00000100 unconditional trap (trapa instruction) 2 5 ? h'00000100 user breakpoint trap 2 n * 2 ? h'00000100 general exception events completed dma address error 2 12 ? h'00000100 nonmaskable interrupt 3 ? ? h'00000600 external hardware interrupt 4 * 3 ? ? h'00000600 general interrupt requests completed h-udi interrupt 4 * 3 ? ? h'00000600 notes: 1. priorities are indicated from high to low, 1 being highest and 4 being lowest. 2. the user defines the break point traps. 1 is a break point before instruction execution and 11 is a break point after instruction execution. for an operand break point, use 11. 3. use software to specify relative priorities of external hardware interrupts and peripheral module interrupts (see section 6, interrupt controller (intc)). 4.1.3 acceptance of exceptions processor resets and interrupts are asynchronous events unrelated to the instruction stream. all exception events are prioritized to establish an acceptance order whenever two or more exception events occur simultaneously. if a power-on reset and manual reset occur simultaneously, the power-on reset takes precedence.
rev. 4.00, 03/04, page 84 of 660 all general exception events occur in a relative order in the execution sequence of an instruction (i.e. execution order), but are handled at priority level 2 in instruction-stream order (i.e. program order), where an exception detected in a preceding instruction is accepted prior to an exception detected in a subsequent instruction. three general exception events (reserved instruction code exception, unconditional trap, and illegal slot instruction exception) are detected in the decode stage (id stage) of different instructions and are mutually exclusive events in the instruction pipeline. they have the same execution priority. figure 4.2 shows the order of general exception acceptance. if instruction n id ex ma tlb miss (data access) wb if instruction n + 1 instruction n + 2 id ex ma tlb miss (instruction access) wb if id ex ma rie (reserved instruction exception) wb pipeline sequence: tlb miss (instruction n) re-execution of instruction n 1 2 3 tlb miss (instruction n + 1) re-execution of instruction n + 1 rie (instruction n + 2) if id ex ma wb legend = instruction fetch = instruction decode = instruction execution = memory access = write back handling order: program order: tlb miss (instruction n+1) tlb miss (instruction n) and rie (instruction n + 2) = simultaneous detection detection order: figure 4.2 example of acceptance order of general exceptions
rev. 4.00, 03/04, page 85 of 660 all exceptions other than a reset are detected in the pipeline id stage, and accepted on instruction boundaries. however, an exception is not accepted between a delayed branch instruction and the delay slot. a re-execution type exception detected in a delay slot is accepted before execution of the delayed branch instruction. a completion type exception detected in a delayed branch instruction or delay slot is accepted after execution of the delayed branch instruction. the delay slot here refers to the next instruction after a delayed unconditional branch instruction, or the next instruction when a delayed conditional branch instruction is true. 4.1.4 exception codes table 4.2 lists the exception codes written to bits 11 to 0 of the expevt register for reset or general exceptions or the intevt and intevt2 registers for general interrupt requests to identify each specific exception event. an additional exception register, the trapa (tra) register, is used to hold the 8-bit immediate data in an unconditional trap (trapa instruction). table 4.2 exception codes exception type exception event exception code power-on reset h'000 manual reset h'020 reset h-udi reset h'000 tlb miss/invalid exception (load) h'040 tlb miss/invalid exception (store) h'060 initial page write exception h'080 tlb protection exception (load) h'0a0 tlb protection exception (store) h'0c0 cpu address error (load) h'0e0 cpu address error (store) h'100 unconditional trap (trapa instruction) h'160 reserved instruction code exception h'180 illegal slot instruction exception h'1a0 user breakpoint trap h'1e0 general exception events dma address error h'5c0
rev. 4.00, 03/04, page 86 of 660 exception type exception event exception code nonmaskable interrupt h'1c0 h-udi interrupt h'5e0 general interrupt requests external hardware interrupts: irl3?irl0 = 0000 h'200 irl3?irl0 = 0001 h'220 irl3?irl0 = 0010 h'240 irl3?irl0 = 0011 h'260 irl3?irl0 = 0100 h'280 irl3?irl0 = 0101 h'2a0 irl3?irl0 = 0110 h'2c0 irl3?irl0 = 0111 h'2e0 irl3?irl0 = 1000 h'300 irl3?irl0 = 1001 h'320 irl3?irl0 = 1010 h'340 irl3?irl0 = 1011 h'360 irl3?irl0 = 1100 h'380 irl3?irl0 = 1101 h'3a0 irl3?irl0 = 1110 h'3c0 note: exception codes h'120, h'140, and h'3e0 are reserved. 4.1.5 exception request and bl bit if a general exception event occurs when the bl bit in sr is 1, the cpu's internal registers are set to their post-reset state, other module registers retain their contents prior to the general exception, and a branch is made to the same address (h'a0000000) as for a reset. if a general interrupt occurs when bl = 1, the request is masked (held pending) and not accepted until the bl bit is cleared to 0 by software. for reentrant exception processing, the spc and ssr must be saved and the bl bit in sr cleared to 0. 4.1.6 returning from exception processing the rte instruction is used to return from exception processing. when rte is executed, the spc value is set in the pc, and the ssr value in sr, and the return from exception processing is performed by branching to the spc address. if the spc and ssr have been saved in the external memory, set the bl bit in sr to 1, then restore the spc and ssr, and issue an rte instruction.
rev. 4.00, 03/04, page 87 of 660 4.2 register description there are four registers related to exception processing. these are peripheral module registers, and therefore reside in area p4. they can be accessed by specifying the address in the privileged mode only. there are following four registers related to exception processing. registers with undefined initial values (trapa exception register, interrupt event register, and interrupt event register 2) should be initialized by software. refer to section 23, list of registers, for more details of the addresses and access sizes. ? exception event register (expevt) ? interrupt event register (intevt) ? interrupt event register 2 (intevt2) ? trapa exception register (tra) 4.2.1 exception event register (expevt) the exception event register (expevt) contains a 12-bit exception code. the exception code set in expevt is that for a reset or general exception event. the exception code is set automatically by hardware when an exception occurs. expevt can also be modified by software. bit bit name initial value r/w description 31 to 12 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 11 to 0 ? * r/w 12-bit exception code note: * h'0000 is set in a power-on reset, and h'020 in a manual reset. 4.2.2 interrupt event register (intevt) the interrupt event register (intevt) contains a 12-bit interrupt exception code or a code indicating the interrupt priority. which is set when an interrupt occurs depends on the interrupt source (refer to section 6, interrupt controller (intc)). the exception code or interrupt priority code is set automatically by hardware when an exception occurs. intevt can also be modified by software.
rev. 4.00, 03/04, page 88 of 660 bit bit name initial value r/w description 31 to 12 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 11 to 0 ?? r/w 12-bit interrupt exception code or a code indicating the interrupt priority 4.2.3 interrupt event register 2 (intevt2) the interrupt event register 2 (intevt2) contains a 12-bit exception code. the exception code set in intevt2 is that for an interrupt request. the exception code is set automatically by hardware when an exception occurs. bit bit name initial value r/w description 31 to 12 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 11 to 0 ?? r/w 12-bit exception code 4.2.4 trapa exception register (tra) the trapa exception register (tra) contains 8-bit immediate data (imm) for the trapa instruction. tra is set automatically by hardware when a trapa instruction is executed. tra can also be modified by software. bit bit name initial value r/w description 31 to 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 9to2 imm ? r/w 8-bit immediate data 1, 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
rev. 4.00, 03/04, page 89 of 660 4.3 operation 4.3.1 reset the reset sequence is used to power up or restart the sh7706 from the initialization state. the resetp signal and resetm signal are sampled every clock cycle, and in the case of a power-on reset, all processing being executed (excluding the rtc) is suspended, all unfinished events are canceled, and reset processing is executed immediately. in the case of a manual reset, however, reset processing is executed after memory access in progress is completed. the reset sequence consists of the following operations: 1. the md bit in sr is set to 1 to place the sh7706 in privileged mode. 2. the bl bit in sr is set to 1, masking any subsequent exceptions. 3. the rb bit in sr is set to 1. 4. an encoded value of h'000 in a power-on reset or h'020 in a manual reset is written to bits 11 to 0 of the expevt register to identify the exception event. 5. instruction execution jumps to the user-written exception handler at address h'a0000000. 4.3.2 interrupts an interrupt processing request is accepted on completion of the current instruction. the interrupt acceptance sequence consists of the following operations: 1. the contents of the pc and sr are saved in spc and ssr, respectively. 2. the bl bit in sr is set to 1, masking any subsequent exceptions. 3. the md bit in sr is set to 1 to place the sh7706 in privileged mode. 4. the rb bit in sr is set to 1. 5. an encoded value identifying the exception event is written to bits 11 to 0 of the intevt and intevt2 registers. 6. instruction execution jumps to the vector location designated by the sum of the value of the contents of the vbr and h'00000600 to invoke the exception handler.
rev. 4.00, 03/04, page 90 of 660 4.3.3 general exceptions when the sh7706 encounters any exception condition other than a reset or interrupt request, it executes the following operations: 1. the contents of the pc and sr are saved in the spc and ssr, respectively. 2. the bl bit in sr is set to 1, masking any subsequent exceptions. 3. the md bit in sr is set to 1 to place the sh7706 in privileged mode. 4. the rb bit in sr is set to 1. 5. an encoded value identifying the exception event is written to bits 11 to 0 of the expevt register. 6. instruction execution jumps to the vector location designated by either the sum of the vector base address and offset h'00000400 in the vector table in a tlb miss trap, or by the sum of the vector base address and offset h'00000100 for exceptions other than tlb miss traps, to invoke the exception handler. 4.4 individual exception operations this section describes the conditions for specific exception processing, and the processor operations. 4.4.1 resets ? power-on reset ? conditions: resetp low ? operations: expevt set to h'000, vbr and sr initialized, branch to pc = h'a0000000. initialization sets the vbr register to h'0000000. in sr, the md, rb and bl bits are set to 1 and the interrupt mask bits (i3 to i0) are set to b'1111. the cpu and on-chip supporting modules are initialized. for details, refer to section 23, list of registers. a power-on reset must always be performed when powering on. a high level is output from the status0 and status1 pins. ? manual reset ? conditions: resetm low ? operations: expevt set to h'020, vbr and sr initialized, branch to pc = h'a0000000. initialization sets the vbr register to h'0000000. in sr, the md, rb, and bl bits are set to 1 and the interrupt mask bits (i3 to i0) are set to b'1111. the cpu and on-chip supporting modules are initialized. for details, refer to section 23, list of registers. a high level is output from the status0 and status1 pins.
rev. 4.00, 03/04, page 91 of 660 ? h-udi reset ? conditions: h-udi reset command input (see section 21, user debugging interface (h- udi)) ? operations: expevt set to h'000, vbr and sr initialized, branch to pc = h'a0000000. initialization sets the vbr register to h'0000000. in sr, the md, rb and bl bits are set to 1 and the interrupt mask bits (i3 to i0) are set to b'1111. the cpu and on-chip supporting modules are initialized. for details, refer to section 23, list of registers. table 4.3 types of reset internal state type conditions for transition to reset state cpu on-chip supporting modules power-on reset resetp = low initialized manual reset resetm = low initialized h-udi reset h-udi reset command input initialized (see register configuration in relevant sections) 4.4.2 general exceptions ? tlb miss exception ? conditions: comparison of tlb addresses shows no address match ? operations: the virtual address (32 bits) that caused the exception is set in tea and the corresponding virtual page number (22 bits) is set in pteh (31 to 10). the asid of pteh indicates the asid at the time the exception occurred. the rc bit in mmucr is incremented by one when all ways are valid, or way-0 is set to the rc with top priority when there is invalid way. the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. if the exception occurred during a read, h'040 is set in expevt; if the exception occurred during a write, h'060 is set in expevt. the bl, md and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0400. to speed up tlb miss processing, the offset differs from other exceptions. ? tlb invalid exception ? conditions: comparison of tlb addresses shows address match but v = 0. ? operations: the virtual address (32 bits) that caused the exception is set in tea and the corresponding virtual page number (22 bits) is set in pteh (31 to 10). the asid of pteh indicates the asid at the time the exception occurred. the way that generated the exception is set in the rc bits in mmucr. the pc and sr of the instruction that generated the exception are saved in the spc and ssr, respectively. if the exception occurred during a read, h'040 is set in expevt; if the exception occurred during a write, h'060 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100.
rev. 4.00, 03/04, page 92 of 660 ? initial page write exception ? conditions: a hit occurred to the tlb for a store access, but d = 0. (this occurs for initial writes to the page registered by the load.) ? operations: the virtual address (32 bits) that caused the exception is set in tea and the corresponding virtual page number (22 bits) is set in pteh (31 to 10). the asid of pteh indicates the asid at the time the exception occurred. the way that generated the exception is set in the rc bit in mmucr. the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. h'080 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs in pc = vbr + h'0100. ? tlb protection exception ? conditions: when a hit access violates the tlb protection information (pr bits) shown below: pr privileged mode user mode 00 only read enabled no access 01 read/write enabled no access 10 only read enabled only read enabled 11 read/write enabled read/write enabled ? operations: the virtual address (32 bits) that caused the exception is set in tea and the corresponding virtual page number (22 bits) is set in pteh (31 to 10). the asid of pteh indicates the asid at the time the exception occurred. the way that generated the exception is set in the rc bits in mmucr. the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. if the exception occurred during a read, h'0a0 is set in expevt; if the exception occurred during a write, h'0c0 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. ? address error ? conditions: when corresponded to the following items. a. instruction fetch from odd address (4n + 1, 4n + 3) b. word data accessed from addresses other than word boundaries (4n + 1, 4n + 3) c. longword accessed from addresses other than longword boundaries (4n + 1, 4n + 2, 4n + 3) d. virtual space accessed in user mode in the area h'80000000 to h'ffffffff.
rev. 4.00, 03/04, page 93 of 660 ? operations: the virtual address (32 bits) that caused the exception is set in tea. the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. if the exception occurred during a read, h'0e0 is set in expevt; if the exception occurred during a write, h'100 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. refer to section 3.5.5, processing flow in event of mmu exception (same processing flow for cpu address error). ? unconditional trap ? conditions: trapa instruction executed ? operations: the exception is a processing-completion type, so the pc of the instruction after the trapa instruction is saved to the spc. sr from the time when the trapa instruction was executing is saved to ssr. the 8-bit immediate value in the trapa instruction is quadrupled and set in tra (9 to 0). h'160 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. ? general illegal instruction exception ? conditions: when corresponded to the following items. a. when undefined code not in a delay slot is decoded delay branch instructions: jmp, jsr, bra, braf, bsr, bsrf, rts, rte, bt/s, bf/s undefined instruction: h'fxxx.(in the case of sr.cl = 1, the value should be b'111111 xxxxxxxxxx.) b. when a privileged instruction not in a delay slot is decoded in user mode privileged instructions: ldc, stc, rte, ldtlb, sleep; instructions that access gbr with ldc/stc are not privileged instructions. ? operations: the pc and sr of the instruction that generated the exception are saved to the spc and ssr, respectively. h'180 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. when an undefined instruction other than h'fxxx is decoded, operation cannot be guaranteed. ? illegal slot instruction exception ? conditions: when corresponded to the following items. a. when undefined code in a delay slot is decoded delay branch instructions: jmp, jsr, bra, braf, bsr, bsrf, rts, rte, bt/s, bf/s undefined instruction: h'fxxx. (in the case of sr.cl = 1, the value should be b'111111 xxxxxxxxxx.) b. when an instruction that rewrites the pc in a delay slot is decoded instructions that rewrite the pc: jmp, jsr, bra, braf, bsr, bsrf, rts, rte, bt, bf, bt/s, bf/s, trapa, ldc rm, sr, ldc.l @rm+, sr c. when a privileged instruction in a delay slot is decoded in user mode privileged instructions: ldc, stc, rte, ldtlb, sleep; instructions that access gbr with ldc/stc are not privileged instructions.
rev. 4.00, 03/04, page 94 of 660 ? operations: the pc of the previous delay branch instruction is saved to the spc. sr of the instruction that generated the exception is saved to ssr. h'1a0 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. when an undefined instruction other than h'fxxx is decoded, operation cannot be guaranteed. ? user break point trap ? conditions: when a break condition set in the user break point controller is satisfied ? operations: when a post-execution break occurs, the pc of the instruction immediately after the instruction that set the break point is set in the spc. if a pre-execution break occurs, the pc of the instruction that set the break point is set in the spc. sr when the break occurs is set in ssr. h'1e0 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. see section 7, user break controller, for more information. ? dma address error ? conditions: when corresponded to the following items. a. word data accessed from addresses other than word boundaries (4n + 1, 4n + 3) b. longword accessed from addresses other than longword boundaries (4n + 1, 4n + 2, 4n + 3) ? operations: the pc of the instruction immediately after the instruction executed before the exception occurs is saved to the spc. sr when the exception occurs is saved to ssr. h'5c0 is set in expevt. the bl, md, and rb bits in sr are set to 1 and a branch occurs to pc = vbr + h'0100. 4.4.3 interrupts ? nmi ? conditions: nmi pin edge detection ? operations: the pc and sr after the instruction that receives the interrupt are saved to the spc and ssr, respectively. h'01c0 is set to intevt and intevt2. the bl, md, and rb bits of the sr are set to 1 and a branch occurs to pc = vbr + h'0600. this interrupt is not masked by sr.imask and received with top priority when the sr's bl bit in sr is 0. when the bl bit is 1, the interrupt is masked. when blmsk in icri is a logic zero and not masked when blmsk in icri is a logic one. see section 6, interrupt controller (intc), for more information.
rev. 4.00, 03/04, page 95 of 660 ? irl interrupts ? conditions: the value of the interrupt mask bits in sr is lower than the irl3 to irl0 level and the bl bit in sr is 0. the interrupt is accepted at an instruction boundary. ? operations: the pc after the instruction that accepts the interrupt is saved to the spc. sr at the time the interrupt is accepted is saved to ssr. the code corresponding to the irl3 to irl0 level is set in intevt and intevt2. the corresponding code is given as h'200 + b' (irl3?irl0) h'20. see table 6.4 for the corresponding code. the bl, md, and rb bits in sr are set to 1 and a branch occurs to vbr + h'0600. the received level is not set in the interrupt mask bit of sr. see section 6, interrupt controller (intc), for more information. ? irq pin interrupts ? conditions: irq pin is asserted and the interrupt mask bit of sr is lower than the irq priority level and the bl bit in sr is 0. the interrupt is accepted at an instruction boundary. ? operations: the pc after the instruction that accepts the interrupt is saved to the spc. the sr at the point the interrupt is accepted is saved to the ssr. the code corresponding to the interrupt source is set to intevt and intevt2. the bl, md, and rb bits of the sr are set to 1 and a branch occurs to vbr + h'0600. the received level is not set to the interrupt mask bit of sr. see section 6, interrupt controller (intc), for more information. ? on-chip peripheral module interrupts ? conditions: the interrupt mask bit of sr is lower than the on-chip peripheral module (tmu,rtc,sci0,sci2,a/d,lcdc,pcc,dmac,wdt,ref)interruptlevelandthe bl bit in sr is 0. the interrupt is accepted at an instruction boundary. ? operations: the pc after the instruction that accepts the interrupt is saved to the spc. the sr at the point the interrupt is accepted is saved to the ssr. the code corresponding to the interrupt source is set to intevt and intevt2. the bl, md, and rb bits of the sr are set to 1 and a branch occurs to vbr + h'0600. see section 6, interrupt controller (intc), for more information. ? h-udi interrupt ? conditions: h-udi interrupt command is input (see section 21.4.4, h-udi interrupt) and the interrupt mask bit of sr is lower than 15 and the bl bit in sr is 0. the interrupt is accepted at an instruction boundary. ? operations: the pc after the instruction that accepts the interrupt is saved to the spc. the sr at the point the interrupt is accepted is saved to the ssr. h'5e0 is set to intevt and intevt2. the bl, md, and rb bits of the sr are set to 1 and a branch occurs to vbr + h'0600. see section 6, interrupt controller (intc), for more information.
rev. 4.00, 03/04, page 96 of 660 4.5 usage note ? return from exception processing ? check the bl bit in sr with software. when the spc and ssr have been saved to external memory, set the bl bit in sr to 1 before restoring them. ? issue an rte instruction. set the spc in the pc and ssr in sr with the rte instruction, branch to the spc address, and return from exception processing. ? operation when exception or interrupt occurs while sr.bl = 1 ? interrupt: acceptance is suppressed until the bl bit in sr is set to 0 by software. if there is a request and the reception conditions are satisfied, the interrupt is accepted after the execution of the instruction that sets the bl bit in sr to 0. during the sleep or standby mode, however, the interrupt will be accepted even when the bl bit in sr is 1. nmi is accepted when blmsk in icr1 is 1. ? exception: no user break point trap will occur even when the break conditions are met. when one of the other exceptions occurs, a branch is made to the fixed address of the reset (h'a0000000). in this case, the values of the expevt, spc, and ssr registers are undefined. differently from general reset processing, no signal is output from status0 and status1. ? spc when an exception occurs: the pc saved to the spc when an exception occurs is as shown below: ? re-executing-type exceptions: the pc of the instruction that caused the exception is set in the spc and re-executed after return from exception processing. if the exception occurred in a delay slot, however, the pc of the immediately prior delayed branch instruction is set in the spc. if the condition of the conditional delayed branch instruction is not satisfied, the delay slot pc is set in spc. ? completed-type exceptions and interrupts: the pc of the instruction after the one that caused the exception is set in the spc. if the exception was caused by a delayed conditional instruction, however, the branch destination pc is set in spc. if the condition of the conditional delayed branch instruction is not satisfied, the delay slot pc is set in spc. ? initial register values after reset ? undefined registers r0_bank0/1 to r7_bank0/1, r8 to r15, gbr, spc, ssr, mach, macl, pr ? initialized registers vbr = h'00000000 sr.md = 1, sr.bl = 1, sr.rb = 1, sr.i3 to sr.i0 = h'f, sr.cl = 0. other sr bits are undefined. pc = h'a0000000
rev. 4.00, 03/04, page 97 of 660 ? ensure that an exception is not generated at an rte instruction delay slot, as operation is not guaranteed in this case. ? when the bl bit in the sr register is set to 1, ensure that a tlb-related exception or address error does not occur at an ldc instruction that updates the sr register and the following instruction. this occurrence will be identified as multiple exceptions, and may initiate reset processing.
rev. 4.00, 03/04, page 98 of 660
rev. 4.00, 03/04, page 99 of 660 section 5 cache 5.1 feature ? instruction/data mixed, 16-byte cache ? 256 entries/way, 4-way set associative, 16-byte block ? write-back/write-through selectable ? lru replacing algorithm ? 1-stage write-back buffer ? a maximum of two ways lockable 5.1.1 cache structure the cache uses a 4-way set associative system. it is composed of four ways (banks), each of which is divided into an address section and a data section. each of the address and data sections is divided into 256 entries. the data section of the entry is called a line. each line consists of 16 bytes (4 bytes 4). the data capacity per way is 4 kbytes (16 bytes 256 entries), with a total of 16 kbytes in the cache as a whole (4 ways). figure 5.1 shows the cache structure. 24 (1 + 1 + 22) bits 128 (32 4) bits 6 bits lw0 to lw3: longword data 0 to 3 entry 0 entry 1 entry 255 0 1 255 0 1 255 v u tag address lw0 lw1 lw2 lw3 address array (ways 0 to 3) data array (ways 0 to 3) lru . . . . . . . . . . . . . . . . . . figure 5.1 cache structure
rev. 4.00, 03/04, page 100 of 660 address array: the v bit indicates whether the entry data is valid. when the v bit is 1, data is valid; when 0, data is not valid. the u bit indicates whether the entry has been written to in write- back mode. when the u bit is 1, the entry has been written to; when 0, it has not. the address tag holds the physical address used in the external memory access. it is composed of 22 bits (address bits 31 to 10) used for comparison during cache searches. in the sh7706, the top three of 32 physical address bits are used as shadow bits (see section 8, bus state controller (bsc)), and therefore in a normal replace operation the top three bits of the tag address are cleared to 0. the v and u bits are initialized to 0 by a power-on reset, but are not initialized by a manual reset. the tag address is not initialized by either a power-on or manual reset. data array: holds a 16-byte instruction or data. entries are registered in the cache in line units (16 bytes). the data array is not initialized by a power-on or manual reset. lru: with the 4-way set associative system, up to four instructions or data with the same entry address (address bits 11 to 4) can be registered in the cache. when an entry is registered, the lru bits show which of the four ways it is recorded in. there are six lru bits, controlled by hardware. a least recently used (lru) algorithm, which selects the way that has been used least recently, is used to select the way. the lru bits also indicate the way to be replaced when a cache miss occurs. table 5.1 shows the relationship between the lru bits and the way to be replaced when cache locking mechanism is disabled. (for details on the case when cache locking mechanism is enabled, see section 5.2.2, cache control register 2 (ccr2)). if a bit pattern other than those listed in table 5.1 is set in the lru bits by software, the cache will not function correctly. when modifying the lru bits by software, set one of the patterns listed in table 5.1. the lru bits are initialized to b'000000 by a power on reset, but are not initialized by a manual reset. table 5.1 lru and way replacement lru (5 to 0) way to be replaced (when cache locking mechanism is disabled) 000000, 000100, 010100, 100000, 110000, 110100 3 000001, 000011, 001011, 100001, 101001, 101011 2 000110, 000111, 001111, 010110, 011110, 011111 1 111000, 111001, 111011, 111100, 111110, 111111 0
rev. 4.00, 03/04, page 101 of 660 5.2 register description the cache includes the following registers. refer to section 23, list of registers, for more details of the addresses and access sizes. ? cache control register (ccr) ? cache control register 2 (ccr2) 5.2.1 cache control register (ccr) the cache is enabled or disabled using the ce bit of the cache control register (ccr). ccr also has a cf bit (which invalidates all cache entries), and a wt and cb bits (which select either write- through mode or write-back mode). programs that change the contents of the ccr register should be placed in address space that is not cached. bit bit name initial value r/w description 31 to 4 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 3 cf 0 r cache flash when 1 is set, the v, u and lru bits of all cache entries are cleared to 0 (flush). this bit is always read as 0. write-back to external memory is not performed when the cache is flushed. 2 cb 0 r/w cache write-back indicates the cache's operating mode for area p1. 0: write-through mode 1: write-back mode 1 wt 0 r/w write through indicates the cache's operating mode for area p0, u0, and p3. 0: write-back mode 1: write-through mode 0 ce 0 r/w cache enable indicates whether to use the cache function. 0: cache not used 1: cache used
rev. 4.00, 03/04, page 102 of 660 5.2.2 cache control register 2 (ccr2) cache control register 2 (ccr2) enables or disables the cache locking mechanism. this register setting is valid only in cache locking mode. cache locking mode is enabled when the cache locking bit (bit 12) of the status register (sr) is set to 1, and disabled when it is cleared to 0. if a cache miss occurs during prefetch instruction (pref) execution in cache locking mode, one line size of data pointed by rn is loaded into the cache according to the w3load, w3lock, w2load, and w2lock bit settings of ccr2 (bits 9, 8, 1, and 0). table 5.2 shows the relationship between each bit setting and the way to be replaced when the prefetch instruction is executed. on the other hand, if a cache hit occurs during prefetch instruction (pref) execution, no data is loaded into the cache and entries that have been valid in the cache are maintained. for instance, if one line size of data pointed by rn exists at way 0, and if the prefetch instruction is executed while the cache lock, w3load, and w3lock are set to 1s, a cache hit occurs and data is not brought to way 3. when a cache is accessed by other than the prefetch instruction in cache locking mode, the ways to be replaced are controlled by the w3lock and w2lock bit settings. table 5.3 shows the relationship between ccr2 bit settings and the way to be replaced. a program to modify the ccr2 contents should be placed at an address area whose data is not cached. bit bit name initial value r/w description 31 to 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 9 8 w3load w3lock 0w w w3load: way 3 load w3lock: way 3 lock when w3loack = 1 & w3load = 1 & sr.cl is 1, the prefetched data will always be loaded into way3. in all other conditions, the prefetched data will be loaded into the way pointed by lru. 7to2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 0 w2load w2lock 0w w w3load: way 2 load w3lock: way 2 lock when w3loack = 1 & w3load = 1 & sr.cl is 1, the prefetched data will always be loaded into way2. in all other conditions, the prefetched data will be loaded into the way pointed by lru. note: do not set 1 into w2load and w3load at the same time.
rev. 4.00, 03/04, page 103 of 660 whenever ccr2 bit 8 (w3lock) or bit 0 (w2lock) is high level the cache is locked. the locked data will not be overwritten unless w3lock bit and w2lock bit are reset or the pref condition during cache locking mode watches. during cache locking mode, the lru in table 5.1 will be replaced by tables 5.4 to 5.6. table 5.2 way to be replaced when cache miss occurs during pref instruction execution cl bit w3load w3lock w2load w2lock way to be replaced 0 **** accordingtolru(table5.1) 1 * 0 * 0 accordingtolru(table5.1) 1 * 0 0 1 accordingtolru(table5.4) 10 1 * 0 accordingtolru(table5.5) 1 0 1 0 1 accordingtolru(table5.6) 10 * 11way2 11 1 0 * way 3 note: do not set 1 into w2load and w3load at the same time. * don't care table 5.3 way to be replaced when cache miss occurs during execution of instruction other than pref instruction cl bit w3load w3lock w2load w2lock way to be replaced 0 **** accordingtolru(table5.1) 1 * 0 * 0 accordingtolru(table5.1) 1 * 0 * 1 accordingtolru(table5.4) 1 * 1 * 0 accordingtolru(table5.5) 1 * 1 * 1 accordingtolru(table5.6) note: do not set 1 into w2load and w3load at the same time. * don't care table 5.4 lru and way replacement (when w2lock=1) lru (5 to 0) way to be replaced 000000, 000001, 000100, 010100, 100000, 100001, 110000, 110100 3 000011, 000110, 000111, 001011, 001111, 010110, 011110, 011111 1 101001, 101011, 111000, 111001, 111011, 111100, 111110, 111111 0
rev. 4.00, 03/04, page 104 of 660 table 5.5 lru and way replacement (when w3lock=1) lru (5 to 0) way to be replaced 000000, 000001, 000011, 001011, 100000, 100001, 101001, 101011 2 000100, 000110, 000111, 001111, 010100, 010110, 011110, 011111 1 110000, 110100, 111000, 111001, 111011, 111100, 111110, 111111 0 table 5.6 lru and way replacement (when w2lock=1 and w3lock=1) lru (5 to 0) way to be replaced 000000, 000001, 000011, 000100, 000110, 000111, 001011, 001111, 010100, 010110, 011110, 011111 1 100000, 100001, 101001, 101011, 110000, 110100, 111000, 111001, 111011, 111100, 111110, 111111 0 5.3 operation 5.3.1 searching the cache if the cache is enabled, whenever instructions or data in memory are accessed the cache will be searched to see if the desired instruction or data is in the cache. figure 5.2 illustrates the method by which the cache is searched. the cache is a physical cache and holds physical addresses in its address section. entries are selected using bits 11 to 4 of the address (virtual) of the access to memory and the address tag of that entry is read. in parallel to reading of the address tag, the virtual address is translated to a physical address in the mmu. the physical address after translation and the physical address read from the address section are compared. the address comparison uses all four ways. when the comparison shows a match and the selected entry is valid (v = 1), a cache hit occurs. when the comparison does not show a match or the selected entry is not valid (v = 0), a cache miss occurs.
rev. 4.00, 03/04, page 105 of 660 0 1 255 v u tag address lw0 lw1 lw2 lw3 ways 0 to 3 ways 0 to 3 31 12 11 4 3 2 1 0 virtual address cmp0 cmp1 cmp2 cmp3 physical address cmp0: comparison circuit 0 cmp1: comparison circuit 1 cmp2: comparison circuit 2 cmp3: comparison circuit 3 legend hit signal 1 entry selection longword (lw) selection mmu figure 5.2 cache search scheme (normal mode) 5.3.2 read access read hit: in a read access, instructions and data are transferred from the cache to the cpu. the lru is updated. read miss: an external bus cycle starts and the entry is updated. the way replaced is shown in table 5.3. entries are updated in 16-byte units. when the desired instruction or data that caused the miss is loaded from external memory to the cache, the instruction or data is transferred to the cpu in parallel with being loaded to the cache. when it is loaded in the cache, the u bit is cleared to 0 and the v bit is set to 1.
rev. 4.00, 03/04, page 106 of 660 5.3.3 prefetch operation prefetch hit: lru is updated so that the way that has been hit to be the latest. other contents of the cache are not updated. instruction or data is not transferred to the cpu. prefetch miss: instruction or data is not transferred to the cpu. the way to be replaced is listed in table 5.2. other operations are same as those in read miss. 5.3.4 write access write hit: in a write access in the write-back mode, the data is written to the cache and the u bit of the entry written is set to 1. writing occurs only to the cache; no external memory write cycle is issued. in the write-through mode, the data is written to the cache and an external memory write cycle is issued. write miss: in the write-back mode, an external write cycle starts when a write miss occurs, and the entry is updated. the way to be replaced is shown in table 5.3. when the u bit of the entry to be replaced is 1, the cache fill cycle starts after the entry is transferred to the write-back buffer. the write-back unit is 16 bytes. data is written to the cache and the u bit and v bit are set to 1. after the cache completes its fill cycle, the write-back buffer writes back the entry to the memory. in the write-through mode, no write to cache occurs in a write miss; the write is only to the external memory. 5.3.5 write-back buffer when the u bit of the entry to be replaced in the write-back mode is 1, it must be written back to the external memory. to increase performance, the entry to be replaced is first transferred to the write-back buffer and fetching of new entries to the cache takes priority over writing back to the external memory. after fetching of new entries to the cache is completed, the data in the write- back buffer is write back to the external memory. during the write back cycles, the cache can be accessed. the write-back buffer can hold one line of the cache data (16 bytes) and its physical address. figure 5.3 shows the configuration of the write-back buffer. longword 0 longword 1 longword 2 longword 3 pa (31 to 4) pa (31 to 4): longword 0 to 3: physical address written to external memory the line of cache data to be written to external memory figure 5.3 write-back buffer configuration
rev. 4.00, 03/04, page 107 of 660 5.3.6 coherency of cache and external memory use software to ensure coherency between the cache and the external memory. to allocate memory shared by this lsi and the external device to an address area to be cached, invalidate the entries by operating the memory allocating cache as required. if necessary, for the memory shared by the cpu and the direct memory access controller in this lsi, invalidation must also be performed in the same way as described above. 5.4 memory-mapped cache to allow software management of the cache, cache contents can be read and written by means of mov instructions in the privileged mode. the cache is mapped onto the p4 area in virtual address space. the address array is mapped onto addresses h'f0000000 to h'f0ffffff, and the data array onto addresses h'f1000000 to h'f1ffffff. only longword can be used as the access size for the address array and data array, and instruction fetches cannot be performed. 5.4.1 address array the address array is mapped onto h'f0000000 to h'f0ffffff. to access an address array, the 32-bit address field (for read/write accesses) and 32-bit data field (for write accesses) must be specified. the address field specifies information for selecting the entry to be accessed; the data field specifies the tag address, v bit, u bit, and lru bits to be written to the address array (figure 5.4 (1)). in the address field, specify the entry address for selecting the entry (bits 11 to 4), w for selecting the way (bits 13 and 12: 00 is way 0, 01 is way 1, 10 is way 2, and 11 is way 3), a for selecting the associative operation (bit 3), and h'f0 to indicate address array access (bits 31 to 24). in data field, specify the tag address (bits 31 to 10), lru bits (bits 9 to 4), u bit (bit 1), and v bit (bit 0). upper three bits of the tag address (bits 31 to 29) should always be 0. the following three operations are enabled for the address array. address array read: read the tag address, lru bits, u bit, and v bit of the entry specified by the entry address and the way number. when reading, no associative operation is performed regardless of the value of the associative bit (bit a) specified in the address. address array write (without associative operation): write the tag address, lru bits, u bit, and v bit specified in the data field to the entry specified by the entry address and the way number. the associative bit (bit a) should be 0. if data is written to the cache line in which u and v bits are set to 1, the cache line is written back, and then the tag address, lru bits, u bit, and v bit specified in the data field are written to. however, when 0 is written to the v bit, 0 must also be written to the u bit of that entry.
rev. 4.00, 03/04, page 108 of 660 address array write (with associative operation): when writing while the associative bit (bit a) is 1, the addresses of four entries selected by the entry addresses are compared to the tag addresses specified in the data field. as a result of the comparison, u bit and v bit specified in the data field are written to the entry for the hit way. note however, that the tag address and lru bits are not changed. when no ways are hit, nothing is written to the address array and no operation occurs. this operation is used to invalidate a specific entry of the cache. when the u bit of the hit entry is 1, write back is occurs. however, when 0 is written to the v bit, 0 must also be written to theubitofthatentry. 5.4.2 data array the data array is mapped onto h'f1000000 to h'f1ffffff. to access a data array, the 32-bit address field (for read/write accesses) and 32-bit data field (for write accesses) must be specified. the address field specifies information for selecting the entry to be accessed; the data field specifies the longword data to be written to the data array. in the address field, specify the entry address for selecting the entry (bits 11 to 4), l indicating the longword position within the (16-byte) line (bits 3 and 2: 00 is longword 0, 01 is longword 1, 10 is longword 2, and 11 is longword 3), w for selecting the way (bits 13 and 12: 00 is way 0, 01 is way 1, 10 is way 2, and 11 is way 3), and h'f1 to indicate data array access (bits 31 to 24). the access size of the data array is fixed at longword, so 00 should be specified to bits 1 and 0 in the address field. the following two operations are enabled for data array. however, information of the address array is not changed by the following operations. data array read: reads data specified by l (bits 3 and 2) in the address field from the entry specified by the entry address and the way number. data array write: writes a longword data specified by the data field to the position specified by l (bits 3 and 2) in the address field from the entry specified by the entry address and the way number.
rev. 4.00, 03/04, page 109 of 660 (1) address array access address specification read access write access data specification (both read and write accesses) (2) data array access (both read and write accesses) address specification 31 24 23 14 13 12 11 4 3 0 1111 0000 * * * * * * * 0 0 * 0 0 w entry address 31 24 23 14 13 12 11 4 3 0 1111 0000 w entry address 2 a 313029 10 4 3 0 lru 2 x 000 x 9 address tag (28?10) uv 1 31 24 23 14 13 12 11 4 3 0 1111 0001 w entry address 0 0 1 2 l data specification 31 0 longword x: 0 for read, don't care for write * : don't care 0 2 figure 5.4 specifying address and data for memory-mapped cache access
rev. 4.00, 03/04, page 110 of 660 5.4.3 usage examples 1. invalidating specific entries specific cache entries can be invalidated by writing 0 to the entry's u and v bit. when the a bit is 1, the address tag specified by the write data is compared to the address tag within the cache selected by the entry address, and data is written when a match is found. if no match is found, there is no operation. when the v bit of the entry is 1, a write back occurs. ;r0 = = = = = = = 2. reading the data of a specific entry this example reads the data section of a specific cache entry. the longword indicated in the data field of the data array in figure 5.6 is read to the register. ;r1 = = = =
rev. 4.00, 03/04, page 111 of 660 section 6 interrupt controller (intc) the interrupt controller (intc) ascertains the priority of interrupt sources and controls interrupt requests to the cpu. the intc has registers for setting the priority of each interrupt, and interrupt requests are handled according to the priorities set in these registers. 6.1 feature intc has the following features: ? 16 levels of interrupt priority can be set: by setting the five interrupt-priority registers, the priorities of on-chip peripheral module, irq interrupts can be selected from 16 levels for individual request sources. ? nmi noise canceler function: nmi input-level bit indicates nmi pin states. by reading this bit in the interrupt exception service routine, the pin state can be checked, enabling it to be used as a noise canceler. ? external devices can be notified that an interrupt has been received ( irqout ): when the sh7706 has released the bus right, the external bus master can be notified that an external interrupt, an on-chip peripheral module interrupt or a memory refresh request has occurred, enabling this lsi to request the bus right.
rev. 4.00, 03/04, page 112 of 660 figure 6.1 is a block diagram of the intc. dmac scif sci adc tmu rtc wdt ref icr input control com- parator priority identifier 3 4 6 interrupt request sr ipra to ipre irl3 to irl0 nmi irq0 to irq5 irqout timer unit realtime clock unit serial communication interface serial communication interface (with fifo) watchdog timer refresh requests in the bus state controller interrupt control register registers a-e for setting the interrupt proprity levels status register direct memory access controller analog-to-digital converter user debugging interface tmu: rtc: sci: scif: wdt: ref: icr: ipra-ipre: sr: dmac: adc: h-udi: cpu internal bus bus interface 2 1 0 h-udi (interrupt request) legend intc ipr (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request/ refresh request) figure 6.1 intc block diagram
rev. 4.00, 03/04, page 113 of 660 6.2 input/output pin table 6.1 lists the intc pin configuration. table 6.1 pin configuration name abbreviation i/o description nonmaskable interrupt input pin nmi i nonmaskable interrupt request signal input interrupt input pins irq5 to irq0 irl3 to irl0 i interrupt request signal input (maskable by interrupt mask bits in sr) interrupt request output pin irqout o output of signal that notifies external devices that an interrupt source or memory refresh has occurred 6.3 interrupt sources there are 4 types of interrupt sources: nmi, irq, irl, and on-chip peripheral modules. the priority of each interrupt is indicated by a priority level value (16 to 0), with level 16 as the highest and level 1 as the lowest. when level 0 is set, the interrupt is masked and interrupt requests are ignored. 6.3.1 nmi interrupts the nmi interrupt has the highest priority level of 16. when the blmsk bit of the interrupt control register (icr1) is 1 or the bl bit of the status register (sr) is 0, nmi interrupts are accepted when the mai bit of the icr1 register is 0. nmi interrupts are edge-detected. in sleep or software standby mode, the interrupt is accepted regardless of the bl. the nmi edge select bit (nmie) in the interrupt control register 0 (icr0) is used to select either the rising or falling edge. when the nmie bit of the icr0 register is changed, the nmi interrupt is not detected for 20 cycles after changing the icr0. nmie to avoid a false detection of the nmi interrupt. nmi interrupt exception processing does not affect the interrupt mask level bits (i3 to i0) in the status register (sr). when the bl bit is 1 and the blmsk bit of the icr1 register is set to 1, only nmi interrupts are accepted and the spc register and ssr register are updated by the nmi interrupt handler, making it impossible to return to the original processing from exception processing initiated prior to the nmi. use should therefore be restricted to cases where return is not necessary. it is possible to wake the chip up from the software standby state with an nmi interrupt (except when the mai bit of the icr1 register is set to 1).
rev. 4.00, 03/04, page 114 of 660 6.3.2 irq interrupt irq interrupts are input by priority from pins irq0 to irq5 with a level or an edge. the priority level can be set by priority setting registers c to d (iprc to iprd) in a range from levels 0 to 15. when using edge-sensing for irq interrupts, clear the interrupt source by having software read 1 from the corresponding bit in irr0, then write 0 to the bit. when the icr1 register is rewritten, irq interrupts may be mistakenly detected, depending on the pin states. to prevent this, rewrite the register while interrupts are masked, then release the mask after clearing the illegal interrupt by writing 0 to interrupt request register 0 (irr0). it is necessary for an edge input interrupt detection to input a pulse width more than two-cycle width by peripheral clock (p )basis. in level detection, keep the level until the cpu accepts an interrupt and starts the interrupt processing. the interrupt mask bits (i3 to i0) of the status register (sr) are not affected by irq interrupt processing. interrupts irq4 to irq0 can wake the chip up from the software standby state when the relevant interrupt level is higher than i3 to i0 in the sr register (but only when the rtc 32-khz oscillator is used). notes: when the irq is used in edge sensitive, pay attention to the following: 1. if an irq edge is input immediately before the cpu enters standby mode (the period between the sleep instruction executed by the cpu to high level of status0), an interrupt may not be detected. in this case, when an irq edge is input again after status0 becomes high level, an interrupt is detected. 2. if an irq edge is input while the frequency is changed by the frqcr stc bit (when the wdt is counting), an interrupt may not be detected. in this case, when an irq edge is input again after the wdt halts counting, an interrupt is detected.
rev. 4.00, 03/04, page 115 of 660 6.3.3 irl interrupts irl interrupts are input by level at pins irl3 to irl0 . the priority level is the higher of those indicated by pins irl3 to irl0 .an irl3 to irl0 value of 0 (0000) indicates the highest-level interrupt request (interrupt priority level 15). a value of 15 (1111) indicates no interrupt request (interrupt priority level 0). figure 6.2 shows an examples of an irl interrupt connection. table 6.2 shows irl pins and interrupt levels. interrupt request priority encoder to 4 this lsi to figure 6.2 example of irl interrupt connection table 6.2 irl3 irl3 irl3 irl3 to irl0 irl0 irl0 irl0 pins and interrupt levels irl3 irl3 irl3 irl3 irl2 irl2 irl2 irl2 irl1 irl1 irl1 irl1 irl0 irl0 irl0 irl0 interrupt priority level interrupt request 0 0 0 0 15 level 15 interrupt request 0 0 0 1 14 level 14 interrupt request 0 0 1 0 13 level 13 interrupt request 0 0 1 1 12 level 12 interrupt request 0 1 0 0 11 level 11 interrupt request 0 1 0 1 10 level 10 interrupt request 0 1 1 0 9 level 9 interrupt request 0 1 1 1 8 level 8 interrupt request 1 0 0 0 7 level 7 interrupt request 1 0 0 1 6 level 6 interrupt request 1 0 1 0 5 level 5 interrupt request 1 0 1 1 4 level 4 interrupt request 1 1 0 0 3 level 3 interrupt request 1 1 0 1 2 level 2 interrupt request 1 1 1 0 1 level 1 interrupt request 1 1 1 1 0 no interrupt request
rev. 4.00, 03/04, page 116 of 660 a noise-cancellation feature is built in, and the irl interrupt is not detected unless the levels sampled at every supporting module cycle remain unchanged for two consecutive cycles, so that no transient level on the irl pin change is detected. in the software standby mode, as the peripheral clock is stopped, noise cancellation is performed using the 32-khz clock for the rtc instead. therefore when the rtc is not used, interruption by means of irl interrupts cannot be performed in software standby mode. the priority level of the irl interrupt must not be lowered unless the interrupt is accepted and the interrupt processing starts. if the level is not retained, correct operation is not guaranteed. however, the priority level can be changed to a higher one. the interrupt mask bits (i3 to i0) in the status register (sr) are not affected by irl interrupt processing. 6.3.4 on-chip peripheral module interrupts on-chip peripheral module interrupts are generated by the following eight modules: ? timer unit (tmu) ? realtime clock (rtc) ? serial communication interface (sci, scif) ? bus state controller (bsc) ? watchdog timer (wdt) ? direct memory access controller (dmac) ? a/d converter (adc) ? user debugging interface (h-udi) not every interrupt source is assigned a different interrupt vector, but sources are reflected in the interrupt event registers (intevt and intevt2), so it is easy to identify sources by branching with the intevt or intevt2 register value as an offset. the priority level (from 0 to 15) can be set for each module except for h-udi by writing to the interrupt priority setting registers a, b and e (ipra, iprb and ipre). the priority level of h- udi interrupt is 15 (fixed). the interrupt mask bits (i3 to i0) of the sr are not affected by the on-chip peripheral module interrupt processing. tmu and rtc interrupts can restore the chip from the software standby state when the relevant interrupt level is higher than i3 to i0 in the sr (but only when the rtc 32-khz oscillator is used).
rev. 4.00, 03/04, page 117 of 660 6.3.5 interrupt exception processing and priority tables 6.3 and 6.4 lists the codes for the interrupt event register (intevt and intevt2), and the order of interrupt priority. each interrupt source is assigned unique code. the start address of the interrupt service routine is common to each interrupt source. this is why, for instance, the value of intevt or intevt2 is used as offset at the start of the interrupt service routine and branched to identify the interrupt source. the order of priority of the on-chip peripheral module, irq, and pint interrupts is set within the priority levels 0 to 15 at will by using the interrupt priority level set to registers a to e (ipra to ipre). the order of priority of the on-chip peripheral module, irq, and pint interrupts is set to zero by reset. when the order of priorities for multiple interrupt sources are set to the same level and such interrupts are generated at the same time, they are processed according to the default order listed in tables 6.3 and 6.4. table 6.3 interrupt exception handling sources and priority (irq mode) interrupt source intevt code (intevt2 code) interrupt priority (initial value) ipr (bit numbers) priority within ipr setting unit default priority nmi h'1c0 (h'1c0) 16 ? ? high h-udi h'5e0 (h'5e0) 15 ? ? irq0 h'200 to 3c0 * (h'600) 0 to 15 (0) iprc (3 to 0) ? irq1 h'200 to 3c0 * (h'620) 0 to 15 (0) iprc (7 to 4) ? irq2 h'200 to 3c0 * (h'640) 0 to 15 (0) iprc (11 to 8) ? irq3 h'200 to 3c0 * (h'660) 0 to 15 (0) iprc (15 to 12) ? irq4 h'200 to 3c0 * (h'680) 0 to 15 (0) iprd (3 to 0) ? irq irq5 h'200 to 3c0 * (h'6a0) 0 to 15 (0) iprd (7 to 4) ? dei0 h'200 to 3c0 * (h'800) high dei1 h'200 to 3c0 * (h'820) dei2 h'200 to 3c0 * (h'840) dmac dei3 h'200 to 3c0 * (h'860) 0to15(0) ipre(15to12) low eri2 h'200 to 3c0 * (h'900) high rxi2 h'200 to 3c0 * (h'920) bri2 h'200 to 3c0 * (h'940) scif (sci2) txi2 h'200 to 3c0 * (h'960) 0to15(0) ipre(7to4) low low
rev. 4.00, 03/04, page 118 of 660 interrupt source intevt code (intevt2 code) interrupt priority (initial value) ipr (bit numbers) priority within ipr setting unit default priority adc adi h'200 to 3c0 * (h'980) 0 to 15 (0) ipre (3 to 0) ? high tmu0 tuni0 h'400 (h'400) 0 to 15 (0) ipra (15 to 12) ? tmu1 tuni1 h'420 (h'420) 0 to 15 (0) ipra (11 to 8) ? tuni2 h'440 (h'440) high tmu2 ticpi2 h'460 (h'460) 0to15(0) ipra(7to4) low ati h'480 (h'480) high pri h'4a0 (h'4a0) rtc cui h'4c0 (h'4c0) 0to15(0) ipra(3to0) low eri h'4e0 (h'4e0) high rxi h'500 (h'500) txi h'520 (h'520) sci (sci0) tei h'540 (h'540) 0to15(0) iprb(7to4) low wdt iti h'560 (h'560) 0 to 15 (0) iprb (15 to 12) ? rcmi h'580 (h'580) high bsc (ref) rovi h'5a0 (h'5a0) 0to15(0) iprb(11to8) low low note: * the code corresponding to an interrupt level shown in table 6.5 is set.
rev. 4.00, 03/04, page 119 of 660 table 6.4 interrupt exception handling sources and priority (irl mode) interrupt source intevt code (intevt2 code) interrupt priority (initial value) ipr (bit numbers) priority within ipr setting unit default priority nmi h'1c0 (h'1c0) 16 ? ? high h-udi h'5e0 (h'5e0) 15 ? ? irl(3:0) = 0000 h'200 (h'200) 15 ? ? irl(3:0) = 0001 h'220 (h'220) 14 ? ? irl(3:0) = 0010 h'240 (h'240) 13 ? ? irl(3:0) = 0011 h'260 (h'260) 12 ? ? irl(3:0) = 0100 h'280 (h'280) 11 ? ? irl(3:0) = 0101 h'2a0 (h'2a0) 10 ? ? irl(3:0) = 0110 h'2c0 (h'2c0) 9 ? ? irl(3:0) = 0111 h'2e0 (h'2e0) 8 ? ? irl(3:0) = 1000 h'300 (h'300) 7 ? ? irl(3:0) = 1001 h'320 (h'320) 6 ? ? irl(3:0) = 1010 h'340 (h'340) 5 ? ? irl(3:0) = 1011 h'360 (h'360) 4 ? ? irl(3:0) = 1100 h'380 (h'380) 3 ? ? irl(3:0) = 1101 h'3a0 (h'3a0) 2 ? ? irl irl(3:0) = 1110 h'3c0 (h'3c0) 1 ? ? irq4 h'200 to 3c0 * (h'680) 0 to 15 (0) iprd (3 to 0) ? irq irq5 h'200 to 3c0 * (h'6a0) 0 to 15 (0) iprd (7 to 4) ? dei0 h'200 to 3c0 * (h'800) high dei1 h'200 to 3c0 * (h'820) dei2 h'200 to 3c0 * (h'840) dmac dei3 h'200 to 3c0 * (h'860) 0to15(0) ipre(15to12) low eri2 h'200 to 3c0 * (h'900) high rxi2 h'200 to 3c0 * (h'920) bri2 h'200 to 3c0 * (h'940) scif (sci2) txi2 h'200 to 3c0 * (h'960) 0to15(0) ipre(7to4) low adc adi h'200 to 3c0 * (h'980) 0 to 15 (0) ipre (3 to 0) ? low
rev. 4.00, 03/04, page 120 of 660 interrupt source intevt code (intevt2 code) interrupt priority (initial value) ipr (bit numbers) priority within ipr setting unit default priority tmu0 tuni0 h'400 (h'400) 0 to 15 (0) ipra (15 to 12) ? high tmu1 tuni1 h'420 (h'420) 0 to 15 (0) ipra (11 to 8) ? tuni2 h'440 (h'440) high tmu2 ticpi2 h'460 (h'460) 0to15(0) ipra(7to4) low ati h'480 (h'480) high pri h'4a0 (h'4a0) rtc cui h'4c0 (h'4c0) 0to15(0) ipra(3to0) low eri h'4e0 (h'4e0) high rxi h'500 (h'500) txi h'520 (h'520) sci (sci0) tei h'540 (h'540) 0to15(0) iprb(7to4) low wdt iti h'560 (h'560) 0 to 15 (0) iprb (15 to 12) ? rcmi h'580 (h'580) high bsc (ref) rovi h'5a0 (h'5a0) 0to15(0) iprb(11to8) low low note: * the code corresponding to an interrupt level shown in table 6.5 is set. table 6.5 interrupt level and intevt code interrupt level intevt code 15 h'200 14 h'220 13 h'240 12 h'260 11 h'280 10 h'2a0 9h'2c0 8h'2e0 7 h'300 6 h'320 5 h'340 4 h'360 3 h'380 2h'3a0 1h'3c0
rev. 4.00, 03/04, page 121 of 660 6.4 register description the intc has the following registers. refer to section 23, list of registers, for more details of the addresses and access sizes. ? interrupt control register 0 (icr0) ? interrupt control register 1 (icr1) ? interrupt priority level setting register a (ipra) ? interrupt priority level setting register b (iprb) ? interrupt priority level setting register c (iprc) ? interrupt priority level setting register d (iprd) ? interrupt priority level setting register e (ipre) ? interrupt request register 0 (irr0) ? interrupt request register 1 (irr1) ? interrupt request register 2 (irr2) 6.4.1 interrupt priority registers a to e (ipra to ipre) the interrupt priority level setting registers a to e (ipra to ipre) are 16-bit read/write registers that set priority levels from 0 to 15 for on-chip peripheral module interrupts. these registers are initialized to h'0000 at power-on reset, manual reset, or in hardware standby mode, but is not initialized in standby mode. table 6.6 lists the relationship between the interrupt sources and the ipra to ipre bits. table 6.6 interrupt request sources and ipra to ipre register bits 15 to 12 bits 11 to 8 bits 7 to 4 bits 3 to 0 ipra tmu0 tmu1 tmu2 rtc iprb wdt ref sci0 reserved * iprc irq3 irq2 irq1 irq0 iprd reserved * reserved * irq5 irq4 ipre dmac reserved * scif adc note: * these bits are always read as 0. the write value should be 0. as shown in table 6.6, four sets of on-chip peripheral module, irq interrupts are assigned to each register. 4-bit groups (bits 15 to 12, bits 11 to 8, bits 7 to 4, and bits 3 to 0) are set with values from h'0 (0000) to h'f (1111). setting h'0 means priority level 0 (masking is requested); h'f is priority level 15 (the highest level). a reset initializes ipra to ipre to h'0000. h'0 should be set into bits corresponding to an unused interrupt.
rev. 4.00, 03/04, page 122 of 660 6.4.2 interrupt control register 0 (icr0) the interrupt control register 0 (icr0) is a 16-bit register that sets the input signal detection mode of the external interrupt input pin nmi and indicates the input signal level to the nmi pin. this register is initialized to h'0000 at power-on reset or manual reset, but is not initialized in standby mode. bit bit name initial value r/w description 15 nmil 0/1 * r nmi input level sets the level of the signal input at the nmi pin. this bit can be read to determine the nmi pin level. this bit cannot be modified. 0: nmi input level is low 1: nmi input level is high 14 to 9 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 8 nmie 0 r/w nmi edge select selects whether the interrupt request signal is detected on the falling or rising edge of nmi input. 0: interrupt request signal is detected on falling edge of nmi input 1: interrupt request signal is detected on rising edge of nmi input 7to0 ? all0 r reserved these bits are always read as 0. the write value should always be 0. note: * when nmi input is high: 1; when nmi input is low: 0.
rev. 4.00, 03/04, page 123 of 660 6.4.3 interrupt control register 1 (icr1) the interrupt control register 1 (icr1) is a 16-bit register that specifies the detection mode to external interrupt input pins, irq0 to irq5 individually: rising edge, falling edge, or low level. bit bit name initial value r/w description 15 mai 0 r/w mask all interrupts when set to 1, masks all interrupt requests when a low level is being input to the nmi pin. masks nmi interrupts in standby mode. 0: all interrupt requests are not masked when a low level is being input to the nmi pin 1: all interrupt requests are masked when a low level is being input to the nmi pin 14 irqlvl 1 r/w interrupt request level detect selects whether the irq3 to irq0 pins are used as four independent interrupt pins or as 15-level interrupt pins encoded as irl3 to irl0 . 0: used as four independent interrupt request pins irq3 to irq0 1: used as encoded 15-level interrupt pins as irl3 to irl0 13 blmsk 0 r/w bl bit mask specifies whether nmi interrupts are masked when the bl bit of the sr register is 1. 0: nmi interrupts are masked when the bl bit is 1 1: nmi interrupts are accepted regardless of the bl bit setting 12 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 11 10 irq51s irq50s 0 0 r/w r/w irq5 sense select select whether the interrupt signal to the irq5 pin is detected at the rising edge, at the falling edge, or at low level. 00: an interrupt request is detected at irq5 input falling edge 01: an interrupt request is detected at irq5 input rising edge 10: an interrupt request is detected at irq5 input low level 11: reserved (setting prohibited)
rev. 4.00, 03/04, page 124 of 660 bit bit name initial value r/w description 9 8 irq41s irq40s 0 0 r/w r/w irq4 sense select select whether the interrupt signal to the irq4 pin is detected at the rising edge, at the falling edge, or at low level. 00: an interrupt request is detected at irq4 input falling edge 01: an interrupt request is detected at irq4 input rising edge 10: an interrupt request is detected at irq4 input low level 11: reserved (setting prohibited) 7 6 irq31s irq30s 0 0 r/w r/w irq3 sense select select whether the interrupt signal to the irq3 pin is detected at the rising edge, at the falling edge, or at low level. 00: an interrupt request is detected at irq3 input falling edge 01: an interrupt request is detected at irq3 input rising edge 10: interrupt request is detected at irq3 input low level 11: rserved (setting prohibited) 5 4 irq21s irq20s 0 0 r/w r/w irq2 sense select select whether the interrupt signal to the irq2 pin is detected at the rising edge, at the falling edge, or at low level. 00: an interrupt request is detected at irq2 input falling edge 01: an interrupt request is detected at irq2 input rising edge 10: an interrupt request is detected at irq2 input low level 11: reserved (setting prohibited)
rev. 4.00, 03/04, page 125 of 660 bit bit name initial value r/w description 3 2 irq11s irq10s 0 0 r/w r/w irq1 sense select select whether the interrupt signal to the irq1 pin is detected at the rising edge, at the falling edge, or at low level. 00: an interrupt request is detected at irq1 input falling edge 01: an interrupt request is detected at irq1 input rising edge 10: an interrupt request is detected at irq1 input low level 11: reserved (setting prohibited) 1 0 irq01s irq00s 0 0 r/w r/w irq0 sense select select whether the interrupt signal to the irq0 pin is detected at the rising edge, at the falling edge, or at low level. 00: an interrupt request is detected at irq0 input falling edge 01: an interrupt request is detected at irq0 input rising edge 10: an interrupt request is detected at irq0 input low level 11: reserved (setting prohibited) 6.4.4 interrupt request register 0 (irr0) the interrupt request register 0 (irr0) is an 8-bit register that indicates interrupt requests from external input pins irq0 to irq5. when clearing irq5r to irq0r bit to 0, 0 should be written to the bit after the bit is set to 1 and the contents of 1 are read. only 0 can be written to irq5r to irq0r. bit bit name initial value r/w description 7, 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
rev. 4.00, 03/04, page 126 of 660 bit bit name initial value r/w description 5 irq5r 0 r/w irq5 interrupt request indicates whether an interrupt request is input to the irq5 pin. when edge detection mode is set for irq5, an interrupt request is cleared by clearing the irq5r bit. 0: an interrupt request is not input to irq5 pin 1: an interrupt request is input to irq5 pin 4 irq4r 0 r/w irq4 interrupt request indicates whether an interrupt request is input to the irq4 pin. when edge detection mode is set for irq4, an interrupt request is cleared by clearing the irq4r bit. 0: an interrupt request is not input to irq4 pin 1: an interrupt request is input to irq4 pin 3 irq3r 0 r/w irq3 interrupt request indicates whether an interrupt request is input to the irq3 pin. when edge detection mode is set for irq3, an interrupt request is cleared by clearing the irq3r bit. 0: an interrupt request is not input to irq3 pin 1: an interrupt request is input to irq3 pin 2 irq2r 0 r/w irq2 interrupt request indicates whether an interrupt request is input to the irq2 pin. when edge detection mode is set for irq2, an interrupt request is cleared by clearing the irq2r bit. 0: an interrupt request is not input to irq2 pin 1: an interrupt request is input to irq2 pin 1 irq1r 0 r/w irq1 interrupt request indicates whether an interrupt request is input to the irq1 pin. when edge detection mode is set for irq1, an interrupt request is cleared by clearing the irq1r bit. 0: an interrupt request is not input to irq1 pin 1: an interrupt request is input to irq1 pin 0 irq0r 0 r/w irq0 interrupt request (irq0r) indicates whether an interrupt request is input to the irq0 pin. when edge detection mode is set for irq0, an interrupt request is cleared by clearing the irq0r bit. 0: an interrupt request is not input to irq0 pin 1: an interrupt request is input to irq0 pin
rev. 4.00, 03/04, page 127 of 660 6.4.5 interrupt request register 1 (irr1) the interrupt request register 1 (irr1) is an 8-bit read-only register that indicates whether dmac or irda interrupt requests are generated. bit bit name initial value r/w description 7to4 ? all0 r reserved these bits are always read as 0. the write value should always be 0. 3 dei3r 0 r dei3 interrupt request indicates whether a dei3 (dmac) interrupt request is generated. 0: a dei3 interrupt request is not generated 1: a dei3 interrupt request is generated 2 dei2r 0 r dei2 interrupt request indicates whether a dei2 (dmac) interrupt request is generated. 0: a dei2 interrupt request is not generated 1: a dei2 interrupt request is generated 1 dei1r 0 r dei1 interrupt request indicates whether a dei1 (dmac) interrupt request is generated. 0: a dei1 interrupt request is not generated 1: a dei1 interrupt request is generated 0 dei0r 0 r dei0 interrupt request indicates whether a dei0 (dmac) interrupt request is generated. 0: a dei0 interrupt request is not generated 1: a dei0 interrupt request is generated
rev. 4.00, 03/04, page 128 of 660 6.4.6 interrupt request register 2 (irr2) the interrupt request register 2 (irr2) is an 8-bit read-only register that indicates whether a/d converter, or scif interrupt requests are generated. bit bit name initial value r/w description 7to5 ? all0 r reserved these bits are always read as 0. the write value should always be 0. 4 adir 0 r adi interrupt request indicates whether an adi (adc) interrupt request is generated. 0: an adi interrupt request is not generated 1: an adi interrupt request is generated 3 txi2r 0 r txi2 interrupt request indicates whether a txi2 (scif) interrupt request is generated. 0: txi2 interrupt request is not generated 1: a txi2 interrupt request is generated 2 bri2r 0 r bri2 interrupt request indicates whether a bri2 (scif) interrupt request is generated. 0: a bri2 interrupt request is not generated 1: a bri2 interrupt request is generated 1 rxi2r 0 r rxi2 interrupt request indicates whether an rxi2 (scif) interrupt request is generated. 0: an rxi2 interrupt request is not generated 1: an rxi2 interrupt request is generated 0 eri2r 0 r eri2 interrupt request indicates whether an eri2 (scif) interrupt request is generated. 0: an eri2 interrupt request is not generated 1: an eri2 interrupt request is generated
rev. 4.00, 03/04, page 129 of 660 6.5 operation 6.5.1 interrupt sequence the sequence of interrupt operations is explained below. figure 6.3 is a flowchart of the operations. 1. the interrupt request sources send interrupt request signals to the interrupt controller. 2. the interrupt controller selects the highest priority interrupt from the interrupt requests sent, following the priority levels set in interrupt priority registers a to e (ipra to ipre). lower priority interrupts are held pending. if two of these interrupts have the same priority level or if multiple interrupts occur within a single module, the interrupt with the highest default priority or the highest priority within its ipr setting unit (as indicated in table 6.3 and table 6.4) is selected. 3. the priority level of the interrupt selected by the interrupt controller is compared with the interrupt mask bits (i3 to i0) in the status register (sr) of the cpu. if the request priority level is higher than the level in bits i3 to i0, the interrupt controller accepts the interrupt and sends an interrupt request signal to the cpu. when the interrupt controller receives an interrupt, a low level is output from the irqout pin. 4. detection timing: the intc operates in synchronization with the peripheral clock (p ), and reports the interrupt request to the cpu. the cpu receives an interrupt at a break in instruction. 5. the interrupt source code is set in the interrupt event registers (intevt and intevt2). 6. the sr and pc are saved to ssr and spc, respectively. 7. thebl,md,andrbinsraresetto1. 8. the cpu jumps to the start address of the interrupt handler (the sum of the value set in the vector base register (vbr) and h'00000600). this jump is not a delayed branch. the interrupt handler may branch with the intevt register value as its offset in order to identify the interrupt source. this enables it to branch to the processing routine for the individual interrupt source. notes: 1. the interrupt mask bits (i3 to i0) in the sr are not changed by acceptance of an interrupt in this lsi. 2. irqout outputs a low level until the interrupt request is cleared. however, if the interrupt source is masked by an interrupt mask bit, the irqout pin returns to the high level. the level is output without regard to the bl bit. 3. the interrupt source flag should be cleared in the interrupt handler. the interrupt source flag should be cleared in the interrupt handler. to ensure that an interrupt request that should have been cleared is not inadvertently accepted again, read the source flag after it has been cleared, then wait for the interval shown in "time for
rev. 4.00, 03/04, page 130 of 660 priority decision and sr mask bit comparison" in table 6.7 before clearing the bl bit or executing an rte instruction. yes yes yes yes yes yes yes yes yes yes yes yes yes no no no no no no no no no no no no no program execution state save sr to ssr; save pc to spc set interrupt cause in intevt, intevt2 set bl/md/rb bits in sr to 1 branch to exception handler interrupt generated? icr1.mai = 1? icr1.blmsk = 1? = 1? nmi = low? nmi? nmi? sr. bl= 0 or sleepmode? level 14 interrupt? level 1 interrupt? i3 to i0 level 13 or lower? i3 to i0 level 0? level 15 interrupt? i3 to i0 level 14 or lower? i3 to i0: interrupt mask bits in status register (sr) figure 6.3 interrupt operation flowchart
rev. 4.00, 03/04, page 131 of 660 6.5.2 multiple interrupts when multiple interrupts are used, the structure of the interrupt service routine should be as follows. 1. branch to a specific interrupt handler corresponding to a code set in intevt and intevt2. the code in intevt and intevt2 can be used as a branch-offset for branching to the specific handler. 2. clear the cause of the interrupt in each specific handler. 3. save ssr and spc to the memory. 4. clear the bl bit in sr, and set the accepted interrupt level in the interrupt mask bits in sr. 5. handle the interrupt. 6. execute the rte instruction. when these procedures are followed in order, an interrupt of higher priority than the one being handled can be accepted after clearing bl in step 4.
rev. 4.00, 03/04, page 132 of 660 6.6 interrupt response time the time from generation of an interrupt request until interrupt exception processing is performed and fetching of the first instruction of the exception handler is started (the interrupt response time) is shown in table 6.7. figure 6.4 shows an example of pipeline operation when an irl interrupt is accepted. when sr.bl is 1, interrupt exception processing is masked, and is kept waiting until completion of an instruction that clears bl to 0. the response time is represented by the clock number of i . depending on the p phase when an interrupt is occurred, one clock period of p may vary from the contents of this table. table 6.7 interrupt response time number of states item nmi irq irl peripheral modules notes 0.5 icyc +1.5pcyc * 3 time for priority decision and sr mask bit comparison 0.5 icyc +1.5bcyc 1.5 icyc +0.5bcyc +2pcyc * 2 0.5 icyc +0.5bcyc +3.5pcyc 0.5 icyc +3pcyc * 4 wait time until end of sequence being executed by cpu x( 0) icyc x ( 0) icyc x ( 0) icyc x ( 0) icyc interrupt exception processing is kept waiting until the executing instruction ends. if the number of instruction execution states is s * 1 , the maximum wait time is: x = s ? 1. however, if bl is set to 1 by instruction execution or by an exception, interrupt exception processing is deferred until completion of an instruction that clears bl to 0. if the following instruction masks interrupt exception processing, the processing may be further deferred. time from interrupt exception processing (save of sr and pc) until fetch of first instruction of exception service routine is started 5icyc 5icyc 5icyc 5icyc
rev. 4.00, 03/04, page 133 of 660 number of states item nmi irq irl peripheral modules notes (5.5 + x) icyc +1.5 pcyc * 3 total (5.5 + x) icyc +1.5 bcyc (6.5 + x) icyc +0.5 bcyc +2 pcyc * 4 (5.5 + x) icyc +0.5 bcyc +3.5 pcyc (5.5 + x) icyc +3 pcyc * 4 minimum case 799.57 * 3 /8.5 * 4 i :b :p = 1:1:1 response time maximum case 10.5 + s 15.5 + s 20.5 + s 10.5 + s * 3 16.5 + s * 4 i :b :p = 4:1:1 icyc: duration of one cycle of i . bcyc: duration of one cycle of b . pcyc: duration of one cycle of p . notes: 1. s also includes the memory access wait time. the processing requiring the maximum execution time is ldc.l @rm+, sr. when the memory access is a cache-hit, this requires seven instruction execution cycles. when the external access is performed, the corresponding number of cycles must be added. there are also instructions that perform two external memory accesses; if the external memory access is slow, the number of instruction execution cycles will increase accordingly. 2. edge detection. 3. extended modules: tmu, rtc, sci, wdt, refc 4. extended modules: dmac, adc, scif
rev. 4.00, 03/04, page 134 of 660 interrupt acceptance irl 0.5 icyc + 0.5 bcyc + 3.5 pcyc instruction (instruction replaced by interrupt exception processing) if id ex ex ex ex if if id ex 5 icyc start of interrupt processing if: instruction fetch: instruction is fetched from memory in which program is stored. id: instruction decode: fetched instruction is decoded. ex: instruction execution: data operation and address calculation are performed in accordance with result of decoding. overrun fetch first instruction of interrupt handler figure 6.4 example of pipeline operations when irl interrupt is accepted
rev. 4.00, 03/04, page 135 of 660 section 7 user break controller the ubc provides functions that simplify program debugging. using this function, a self-monitor debugger can be easily prepared, and a program can be debugged using this lsi alone, without using an in-circuit emulator. instruction fetches, data read/write, data size, data contents, address values, and the timing to stop execution at instruction fetch can be set to the ubc. the ubc block diagram is shown in figure 7.1. 7.1 feature the ubc has the following features: ? the following break comparison conditions can be set. number of break channels: (channels a and b) address: comparison bits are masked in units of 32 bits. one of the two address buses (the virtual address bus (lab) and the internal address bus (iab)) can be selected data: only on channel b, 32-bit maskable one of two data buses (the virtual data bus (ldb) or the internal data bus (idb)) can be selected. bus master: cpu cycle or dmac cycle bus cycle: instruction fetch or data access read/write operand size: byte, word, or longword ? a user-designed user-break condition exception processing routine can be run. ? in an instruction fetch cycle, it can be selected that a break is set before or after an instruction is executed. ? the number of repeat times can be specified as a break condition (it is only for channel b). maximum repeat times for the break condition: 2 12 ?1times. ? eight pairs of branch source/destination buffers.
rev. 4.00, 03/04, page 136 of 660 bbra bara bamra basra asid comparator cpu state signals iab lab mdb access comparator address comparator channel a asid comparator access comparator address comparator data comparator pc trace control channel b bbrb betr barb bamrb basrb bdrb bdmrb brsr brdr brcr user break request ubc location ccn location ldb/idb access control legend bbra : break bus cycle register a bara : break address register a bamra : break address mask register a basra : break asid register a bbrb : break bus cycle register b barb : break address register b bamrb : break address mask register b basrb : break asid register b bdrb : break data register b bdmrb : break data mask register b betr : break execution times register brsr : branch source register brdr : branch destination register brcr : break control register figure 7.1 block diagram of user break controller
rev. 4.00, 03/04, page 137 of 660 7.2 register description the ubc has the following registers. refer to section 23, list of registers, for more details of the addresses and access sizes. ? break address register a (bara) ? break address mask register a (bamra) ? break bus cycle register a (bbra) ? break address register b (barb) ? break address mask register b (bamrb) ? break bus cycle register b (bbrb) ? break data register b (bdrb) ? break data mask register b (bdmrb) ? break control register (brcr) ? execution count break register (betr) ? branch source register (brsr) ? branch destination register (brdr) ? break asid register a (basra) ? break asid register b (basrb) 7.2.1 break address register a (bara) bara is a 32-bit read/write register. bara specifies the address used as a break condition in channel a. bit bit name initial value r/w description 31 to 0 baa31 to baa0 all 0 r/w break address stores the address on the lab or iab that specifies break conditions of channel a.
rev. 4.00, 03/04, page 138 of 660 7.2.2 break address mask register a (bamra) bamra is a 32-bit read/write register. bamra specifies bits masked in the break address specified by bara. bit bit name initial value r/w description 31 to 0 bama31 to bama0 all 0 r/w break address mask bit specifies bits masked in the channel a break address bits specified by bara (baa31 to baa0). 0: break address bit baan of channel a is included in the break condition 1: break address bit baan of channel a is masked and is not included in the break condition note: n = 31 to 0. 7.2.3 break bus cycle register a (bbra) break bus cycle register a (bbra) is a 16-bit read/write register, which specifies (1) cpu cycle or dmac cycle, (2) instruction fetch or data access, (3) read or write, and (4) operand size in the break conditions of channel a. bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 6 cda1 cda0 0 0 r/w r/w cpu cycle/dmac cycle select a selects the cpu cycle or dmac cycle as the bus cycle of the channel a break condition. 00: condition comparison is not performed x1: the break condition is the cpu cycle 10: the break condition is the dmac cycle
rev. 4.00, 03/04, page 139 of 660 bit bit name initial value r/w description 5 4 ida1 ida0 0 0 r/w r/w instruction fetch/data access select a selects the instruction fetch cycle or data access cycle as the bus cycle of the channel a break condition. 00: condition comparison is not performed 01: the break condition is the instruction fetch cycle 10: the break condition is the data access cycle 11: the break condition is the instruction fetch cycle or data access cycle 3 2 rwa1 rwa0 0 0 r/w r/w read/write select a selects the read cycle or write cycle as the bus cycle of the channel a break condition. 00: condition comparison is not performed 01: the break condition is the read cycle 10: the break condition is the write cycle 11: the break condition is the read cycle or write cycle 1 0 sza1 sza0 0 0 r/w r/w operand size select a selects the operand size of the bus cycle for the channel a break condition. 00: the break condition does not include operand size 11: the break condition is byte access 10: the break condition is word access 11: the break condition is longword access note: x don't care 7.2.4 break address register b (barb) barb is a 32-bit read/write register. barb specifies the address used as a break condition in channel b. bit bit name initial value r/w description 31 to 0 bab31 to bab0 all 0 r/w break address stores the address of lab or iab that specifies the break conditions of channel b.
rev. 4.00, 03/04, page 140 of 660 7.2.5 break address mask register b (bamrb) bamrb is a 32-bit read/write register. bamrb specifies bits masked in the break address specified by barb. bit bit name initial value r/w description 31 to 0 bamb31 to bamb0 all 0 r/w break address mask specifies bits masked in the channel b break address bits specified by barb (bab31 to bab0). 0: break address babn of channel b is included in the break condition 1: break address babn of channel b is masked and is not included in the break condition note: n = 31 to 0 7.2.6 break data register b (bdrb) bdrb is a 32-bit read/write register. bit bit name initial value r/w description 31 to 0 bdb31 to bdb0 all 0 r/w break data bit 7.2.7 break data mask register b (bdmrb) bdmrb is a 32-bit read/write register. bdmrb specifies bits masked in the break data specified by bdrb. bit bit name initial value r/w description 31 to 0 bdmb31 to bdmb0 all 0 r/w break data mask 0: break data bdbn of channel b is included in the break condition 1: break data bdbn of channel b is masked and is not included in the break condition notes: n = 31 to 0 specify an operand size when including the value of the data bus in the break condition. when a byte size is selected as a break condition, the break data must be set in bits 15 to 8 in bdrb for an even break address and bits 7 to 0 for an odd break address.
rev. 4.00, 03/04, page 141 of 660 7.2.8 break bus cycle register b (bbrb) break bus cycle register b (bbrb) is a 16-bit read/write register, which specifies, (1) cpu cycle or dmac cycle, (2) instruction fetch or data access, (3) read/write, and (4) operand size in the break conditions of channel b. bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. these bits are always read as 0. 7 6 cdb1 cdb0 0 0 r/w r/w cpu cycle/dmac cycle select b select the cpu cycle or dmac cycle as the bus cycle of the channel b break condition. 00: condition comparison is not performed x1: the break condition is the cpu cycle 10: the break condition is the dmac cycle 5 4 idb1 idb0 0 0 r/w r/w instruction fetch/data access select b select the instruction fetch cycle or data access cycle as the bus cycle of the channel b break condition. 00: condition comparison is not performed 01: the break condition is the instruction fetch cycle 10: the break condition is the data access cycle 11: the break condition is the instruction fetch cycle or data access cycle 3 2 rwb1 rwb0 0 0 r/w r/w read/write select b select the read cycle or write cycle as the bus cycle of the channel b break condition. 00: condition comparison is not performed 01: the break condition is the read cycle 10: the break condition is the write cycle 11: the break condition is the read cycle or write cycle
rev. 4.00, 03/04, page 142 of 660 bit bit name initial value r/w description 1 0 szb1 szb0 0 0 r/w r/w operand size select b select the operand size of the bus cycle for the channel b break condition. 00: the break condition does not include operand size 01: the break condition is byte access 10: the break condition is word access 11: the break condition is longword access note: x : don't care 7.2.9 break control register (brcr) brcr sets the following conditions: 1. channels a and b are used in two independent channels condition or under the sequential condition. 2. a break is set before or after instruction execution. 3. a break is set by the number of execution times. 4. determine whether to include data bus on channel b in comparison conditions. 5. enable pc trace. 6. enable the asid check. the break control register (brcr) is a 32-bit read/write register that has break conditions match flags and bits for setting a variety of break conditions. bit bit name initial value r/w description 31 to 22 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 21 basma 0 r/w break asid mask a specifies whether the bits of the channel a break asid7 to asid0 (basa7 to basa0) set in basra are masked or not. 0: all basra bits are included in break condition, asid is checked 1: no basra bits are included in break condition, asid is not checked
rev. 4.00, 03/04, page 143 of 660 bit bit name initial value r/w description 20 basmb 0 r/w break asid mask b specifies whether the bits of channel b break asid7 to asid0 (basb7 to basb0) set in basrb are masked or not. 0: all basrb bits are included in break condition, asid is checked 1: no basrb bits are included in break condition, asid is not checked 19 to 16 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 15 scmfca 0 r/w cpu condition match flag a when the cpu bus cycle condition in the break conditions set for channel a is satisfied, this flag is set to 1 (not cleared to 0). in order to clear this flag, write 0intothisbit. 0: the cpu cycle condition for channel a does not match 1: the cpu cycle condition for channel a matches 14 scmfcb 0 r/w cpu condition match flag b when the cpu bus cycle condition in the break conditions set for channel b is satisfied, this flag is set to 1 (not cleared to 0). in order to clear this flag, write 0intothisbit. 0: the cpu cycle condition for channel b does not match 1: the cpu cycle condition for channel b matches 13 scmfda 0 r/w dmac condition match flag a when the on-chip dmac bus cycle condition in the break conditions set for channel a is satisfied, this flag is set to 1 (not cleared to 0). in order to clear this flag, write 0 into this bit. 0: the dmac cycle condition for channel a does not match 1: the dmac cycle condition for channel a matches
rev. 4.00, 03/04, page 144 of 660 bit bit name initial value r/w description 12 scmfdb 0 r/w dmac condition match flag b when the on-chip dmac bus cycle condition in the break conditions set for channel b is satisfied, this flag is set to 1 (not cleared to 0). in order to clear this flag, write 0 into this bit. 0: the dmac cycle condition for channel b does not match 1: the dmac cycle condition for channel b matches 11 pcte 0 r/w pc trace enable enables pc trace. 0: disables pc trace 1: enables pc trace 10 pcba 0 r/w pc break select a (pcba) selects the break timing of the instruction fetch cycle for channel a as before or after instruction execution. 0: pc break of channel a is set before instruction execution 1: pc break of channel a is set after instruction execution 9, 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 dbeb 0 r/w data break enable b selects whether or not the data bus condition is included in the break condition of channel b. 0: no data bus condition is included in the condition of channel b 1: the data bus condition is included in the condition of channel b 6 pcbb 0 r/w pc break select b selects the break timing of the instruction fetch cycle for channel b as before or after instruction execution. 0: pc break of channel b is set before instruction execution 1: pc break of channel b is set after instruction execution 5, 4 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
rev. 4.00, 03/04, page 145 of 660 bit bit name initial value r/w description 3 seq 0 r/w sequence condition select selects two conditions of channels a and b as independent or sequential. 0: channels a and b are compared under the independent condition 1: channels a and b are compared under the sequential condition 2, 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 0 etbe 0 r/w the number of execution times break enable enable the execution-times break condition only on channel b. if this bit is 1 (break enable), a user break is issued when the number of break conditions matches with the number of execution times that is specified by the betr register. 0: the execution-times break condition is masked on channel b 1: the execution-times break condition is enabled on channel b 7.2.10 execution times break register (betr) when the execution-times break condition of channel b is enabled, this register specifies the number of execution times to make the break. the maximum number is 2 12 ?1times.everytime the break condition is satisfied, betr is decremented by 1. a break is issued when the break condition is satisfied after the betr becomes h'0001. bit bit name initial value r/w description 15 to 12 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 11 to 0 ? all 0 r/w number of execution times
rev. 4.00, 03/04, page 146 of 660 7.2.11 branch source register (brsr) brsr is a 32-bit read register. brsr stores the last fetched address before branch and the pointer (3 bits) which indicates the number of cycles from fetch to execution for the last executed instruction. brsr has the flag bit that is set to 1 when branch occurs. this flag bit is cleared to 0, when brsr is read and also initialized by power-on resets or manual resets. other bits are not initialized by reset. eight brsr registers have queue structure and a stored register is shifted every branch. bit bit name initial value r/w description 31 svf 0 r brsr valid flag indicates whether the address and the pointer by which the branch source address can be calculated. when a branch source address is fetched, this flag is set to 1. this flag is cleared to 0 in reading brsr. 0: the value of brsr register is invalid 1: the value of brsr register is valid 30 to 28 pid2 to pid0 ? r instruction decode pointer pid is a 3-bit binary pointer (0 to 7). these bits indicate the instruction buffer number which stores the last executed instruction before branch. even: pid indicates the instruction buffer number. odd: pid+2 indicates the instruction buffer number 27 to 0 bsa27 to bsa0 ? r branch source address these bits store the last fetched address before branch.
rev. 4.00, 03/04, page 147 of 660 7.2.12 branch destination register (brdr) brdr is a 32-bit read register. brdr stores the branch destination fetch address. brdr has the flag bit that is set to 1 when branch occurs. this flag bit is cleared to 0, when brdr is read and also initialized by power-on resets or manual resets. other bits are not initialized by resets. eight brdr registers have queue structure and a stored register is shifted every branch. bit bit name initial value r/w description 31 dvf 0 r brdr valid flag indicates whether a branch destination address is stored. when a branch destination address is fetched, this flag is set to 1. this flag is set to 0 in reading brdr. 0: the value of brdr register is invalid 1: the value of brdr register is valid 30 to 28 ? ? r reserved these bits are always read as 0. the write value should always be 0. 27 to 0 bda27 to bda0 ? r branch destination address these bits store the first fetched address after branch. 7.2.13 break asid register a (basra) break asid register a (basra) is an 8-bit read/write register that specifies the asid that serves as the break condition for channel a. it is not initialized by resets. it is located in ccn. bit bit name initial value r/w description 7 to 0 basa7 to basa0 ? r/w break asid these bits store the asid (bits 7 to 0) that is the channel a break condition.
rev. 4.00, 03/04, page 148 of 660 7.2.14 break asid register b (basrb) break asid register b (basrb) is an 8-bit read/write register that specifies the asid that serves as the break condition for channel b. it is not initialized by resets. it is located in ccn. bit bit name initial value r/w description 7 to 0 basb7 to basb0 ? r/w break asid these bits store the asid (bits 7 to 0) that is the channel b break condition. 7.3 operation 7.3.1 flow of the user break operation the flow from setting of break conditions to user break exception processing is described below: 1. the break addresses and the corresponding asids are loaded in the bara, barb, basra and basrb. the masked addresses are set in the bamra and bamrb. the break data is set in the bdrb. the masked data is set in the bdmrb. the breaking bus conditions are set in the bbra and bbrb. three groups of the bbra and bbrb (cpu cycle/dmac cycle select, instruction fetch/data access select, and read/write select) are each set. no user break will be generated if even one of these groups is set with 00. the respective conditions are set in the bits of the brcr. 2. when the break conditions are satisfied, the ubc sends a user break request to the interrupt controller. the break type will be sent to cpu indicating the instruction fetch, pre/post instruction break, or data access break. when conditions match up, the cpu condition match flags (scmfca and scmfcb) and dmac condition match flags (scmfda and scmfdb) for the respective channels are set. 3. the appropriate condition match flags (scmfca, scmfda, scmfcb, and scmfdb) can be used to check if the set conditions match or not. the matching of the conditions sets flags, but they are not reset. 0 must first be written to them before they can be used again. 4. there is a chance that the data access break and its following instruction fetch break occur around the same time, there will be only one break request to the cpu, but these two break channel match flags could be both set.
rev. 4.00, 03/04, page 149 of 660 7.3.2 break on instruction fetch cycle 1. when cpu/instruction fetch/read/word or longword is set in the break bus cycle registers (bbra/bbrb), the break condition becomes the cpu instruction fetch cycle. whether it then breaks before or after the execution of the instruction can then be selected with the pcba/pcbb bits of the break control register (brcr) for the appropriate channel. 2. an instruction set for a break before execution breaks when it is confirmed that the instruction has been fetched and will be executed. this means this feature cannot be used on instructions fetched by overrun (instructions fetched at a branch or during an interrupt transition, but not to be executed). when this kind of break is set for the delay slot of a delay branch instruction, the break is generated prior to execution of the instruction that then first accepts the break. meanwhile, the break set for pre-instruction-break on delay slot instruction and post- instruction-break on sleep instruction are also prohibited. 3. when the condition is specified to be occurred after execution, the instruction set with the break condition is executed and then the break is generated prior to the execution of the next instruction. as with pre-execution breaks, this cannot be used with overrun fetch instructions. when this kind of break is set for a delay branch instruction, the break is generated at the instruction that then first accepts the break. 4. when an instruction fetch cycle is set for channel b, break data register b (bdrb) is ignored. there is thus no need to set break data for the break of the instruction fetch cycle. 7.3.3 break by data access cycle 1. the memory cycles in which cpu data access breaks occur are from instructions. 2. the relationship between the data access cycle address and the comparison condition for operand size are listed in table 7.1: table 7.1 data access cycle addresses and operand size comparison conditions access size address compared longword compares break address register bits 31 to 2 to address bus bits 31 to 2 word compares break address register bits 31 to 1 to address bus bits 31 to 1 byte compares break address register bits 31 to 0 to address bus bits 31 to 0 this means that when address h'00001003 is set without specifying the size condition, for example, the bus cycle in which the break condition is satisfied is as follows (where other conditions are met). longword access at h'00001000 word access at h'00001002 byte access at h'00001003 3. when the data value is included in the break conditions on b channel:
rev. 4.00, 03/04, page 150 of 660 when the data value is included in the break conditions, either longword, word, or byte is specified as the operand size of the break bus cycle registers (bbra and bbrb). when data values are included in break conditions, a break is generated when the address conditions and data conditions both match. to specify byte data for this case, set the same data in two bytes at bits 15 to 8 and bits 7 to 0 of the break data register b (bdrb) and break data mask register b (bdmrb). when word or byte is set, bits 31 to 16 of bdrb and bdmrb are ignored. 4. when the dmac data access is included in the break condition: when the address is included in the break condition on dmac data access, the operand size of the break bus cycle registers (bbra and bbrb) should be byte, word or no specified operand size. when the data value is included, select either byte or word. 7.3.4 sequential break 1. by specifying seq in brcr is set to 1, the sequential break is issued when channel b break condition matches after channel a break condition matches. a user break is ignored even if channel b break condition matches before channel a break condition matches. when channels a and b condition match at the same time, the sequential break is not issued. 2. in sequential break specification, logical or internal bus can be selected and the execution times break condition can be also specified. for example, when the execution times break condition is specified, the break condition is satisfied at channel b condition match with betr = h'0001 after channel a condition match. 7.3.5 value of saved program counter the pc when a break occurs is saved to the spc in user breaks. the pc value saved is as follows depending on the type of break. 1. when instruction fetch (before instruction execution) is specified as a break condition: the value of the program counter (pc) saved is the address of the instruction that matches the break condition. the fetched instruction is not executed, and a break occurs before it. 2. when instruction fetch (after instruction execution) is specified as a break condition: the pc value saved is the address of the instruction to be executed following the instruction in which the break condition matches. the fetched instruction is executed, and a break occurs before the execution of the next instruction. 3. when data access (address only) is specified as a break condition: the pc value is the address of the instruction to be executed following the instruction that matched the break condition. the instruction that matched the condition is executed and the break occurs before the next instruction is executed. 4. when data access (address + data) is specified as a break condition:
rev. 4.00, 03/04, page 151 of 660 the pc value is the start address of the instruction that follows the instruction already executed when break processing started up. when a data value is added to the break conditions, the place where the break will occur cannot be specified exactly. the break will occur before the execution of an instruction fetched around the data access where the break occurred. 7.3.6 pc trace 1. setting pcte in brcr to 1 enables pc traces. when branch (branch instruction, repeat, and interrupt) is generated, the address from which the branch source address can be calculated and the branch destination address are stored in brsr and brdr, respectively. the branch address and the pointer, which corresponds to the branch, are included in brsr. 2. the branch address before branch occurs can be calculated from the address and the pointer stored in brsr. the expression from bsa (the address in brsr), pid (the pointer in brsr), and ia (the instruction address before branch occurs) is as follows: ia = bsa ? 2 * pid. notes are needed when an interrupt (a branch) is issued before the branch destination instruction is executed. in case of the next figure, the instruction ?exec? executed immediately before branch is calculated by ia = bsa ? 2 * pid. however, when branch ?branch? has delay slot and the destination address is 4n + 2 address, the address ?dest? which is specified by branch instruction is stored in brsr (dest = bsa). therefore, as ia = bsa ? 2 * pid is not applied to this case, this pid is invalid. the case where bsa is 4n + 2 boundary is applied only to this case and then some cases are classified as follows: exec:branch dest dest:instr (not executed) interrupt int: interrupt routine if the pid value is odd, instruction buffer indicates pid+2 buffer. however, these expressions in this table are accounted for it. therefore, the true branch source address is calculated with bsa and pid values stored in brsr. 3. the branch address before branch occurrence, ia, has different values due to some kinds of branch. a. branch instruction the branch instruction address b. interrupt the last instruction executed before interrupt the top address of interrupt routine is stored in brdr. 4. brsr and brdr have eight pairs of queue structures. the top of queues is read first when the address stored in the pc trace register is read. brsr and brdr share the read pointer. read brsr and brdr in order, the queue only shifts after brdr is read. when reading brdr, longword access should be used. also, the pc trace has a trace pointer, which initially points to the bottom of the queues. the first pair of branch addresses will be stored at the bottom of
rev. 4.00, 03/04, page 152 of 660 the queues, then push up when next pairs come into the queues. the trace pointer will points to the next branch address to be executed, unless it got push out of the queues. when the branch address has been executed, the trace pointer will shift down to next pair of addresses, until it reaches the bottom of the queues. after switching the pcte bit (in brcr) off and on, the values in the queues are invalid. the read pointer stay at the position before pcte is switched, but the trace pointer restart at the bottom of the queues.
rev. 4.00, 03/04, page 153 of 660 7.3.7 usage examples break condition specified to a cpu instruction fetch cycle 1. register specifications bara = h'00000404, bamra = h'00000000, bbra = h'0054, barb = h'00008010, bamrb = h'00000006, bbrb = h'0054, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00300400 specified conditions: channel a/channel b independent mode channela address: h'00000404, address mask: h'00000000 bus cycle: cpu/instruction fetch (after instruction execution)/read (operand size is not included in the condition) no asid check is included channelb address: h'00008010, address mask: h'00000006 data: h'00000000, data mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/read (operand size is not included in the condition) no asid check is included a user break occurs after an instruction of address h'00000404 is executed or before instructions of adresses h'00008010 to h'00008016 are executed. 2. register specifications bara = h'00037226, bamra = h'00000000, bbra = h'0056, barb = h'0003722e, bamrb = h'00000000, bbrb = h'0056, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000008, basra = h'80, basrb = h'70 specified conditions: channel a/channel b sequence mode channela address: h'00037226, address mask: h'00000000, asid = h'80 bus cycle: cpu/instruction fetch (before instruction execution)/read/word channelb address: h'0003722e, address mask: h'00000000, asid = h'70 data: h'00000000, data mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/read/word an instruction with asid = h'80 and address h'00037226 is executed, and a user break occurs before an instruction with asid = h'70 and address h'0003722e is executed.
rev. 4.00, 03/04, page 154 of 660 3. register specifications bara = h'00027128, bamra = h'00000000, bbra = h'005a, barb = h'00031415, bamrb = h'00000000, bbrb = h'0054, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00300000 specified conditions: channel a/channel b independent mode channela address: h'00027128, address mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/write/word no asid check is included channelb address: h'00031415, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/read (operand size is not included in the condition) no asid check is included on channel a, no user break occurs since instruction fetch is not a write cycle. on channel b, no user break occurs since instruction fetch is performed for an even address. 4. register specifications bara = h'00037226, bamra = h'00000000, bbra = h'005a, barb = h'0003722e, bamrb = h'00000000, bbrb = h'0056, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000008, basra = h'80, basrb = h'70 specified conditions: channel a/channel b sequence mode channela address: h'00037226, address mask: h'00000000, asid: h'80 bus cycle: cpu/instruction fetch (before instruction execution)/write/word channelb address: h'0003722e, address mask: h'00000000, asid: h'70 data: h'00000000, data mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/read/word since instruction fetch is not a write cycle on channel a, a sequence condition does not match. therefore, no user break occurs. 5. register specifications bara = h'00000500, bamra = h'00000000, bbra = h'0057, barb = h'00001000, bamrb = h'00000000, bbrb = h'0057, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00300001, betr = h'0005 specified conditions: channel a/channel b independent mode channela address: h'00000500, address mask: h'00000000
rev. 4.00, 03/04, page 155 of 660 bus cycle: cpu/instruction fetch (before instruction execution)/read/longword channelb address: h'00001000, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/read/longword the number of execution-times break enable (5 times) on channel a, a user break occurs before an instruction of address h'00000500 is executed. on channel b, a user break occurs before the fifth instruction execution after instructions of address h'00001000 are executed four times. 6. register specifications bara = h'00008404, bamra = h'00000fff, bbra = h'0054, barb = h'00008010, bamrb = h'00000006, bbrb = h'0054, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000400, basra = h'80, basrb = h'70 specified conditions: channel a/channel b independent mode channela address: h'00008404, address mask: h'00000fff, asid: h'80 bus cycle: cpu/instruction fetch (after instruction execution)/read (operand size is not included in the condition) channelb address: h'00008010, address mask: h'00000006, asid: h'70 data: h'00000000, data mask: h'00000000 bus cycle: cpu/instruction fetch (before instruction execution)/read (operand size is not included in the condition) a user break occurs after an instruction with asid = h'80 and address h'00008000 to h'00008ffe is executed or before instructions with asid = h'70 and addresses h'00008010 to h'00008016 are executed. break condition specified to a cpu data access cycle 1. register specifications bara = h'00123456, bamra = h'00000000, bbra = h'0064, barb = h'000abcde, bamrb = h'000000ff, bbrb = h'006a, bdrb = h'0000a512, bdmrb = h'00000000, brcr = h'00000080, basra = h'80, basrb = h'70 specified conditions: channel a/channel b independent mode channela address: h'00123456, address mask: h'00000000 bus cycle: cpu/data access/read (operand size is not included in the condition) channelb address: h'000abcde, address mask: h'000000ff, asid: h'70
rev. 4.00, 03/04, page 156 of 660 data: h'0000a512, data mask: h'00000000 bus cycle: cpu/data access/write/word on channel a, a user break occurs with asid = h'80 during longword read to address h'00123454, word read to address h'00123456, or byte read to address h'00123456. on channel b, a user break occurs with asid = h'70 when word h'a512 is written in addresses h'000abc00 to h'000abcfe. break condition specified to a dmac data access cycle 1. register specifications: bara = h'00314156, bamra = h'00000000, bbra = h'0094, barb = h'00055555, bamrb = h'00000000, bbrb = h'00a9, bdrb = h'00000078, bdmrb = h'0000000f, brcr = h'00000080, basra = h'80, basrb = h'70 specified conditions: channel a/channel b independent mode channela address: h'00314156, address mask: h'00000000, asid: h'80 bus cycle: dmac/instruction fetch/read (operand size is not included in the condition) channelb address: h'00055555, address mask: h'00000000, asid: h'70 data: h'00000078, data mask: h'0000000f bus cycle: dmac/data access/write/byte on channel a, no user break occurs since instruction fetch is not performed in dmac cycles. on channel b, a user break occurs with asid = h'70 when the dmac writes byte h'7* in address h'00055555. 7.4 usage note 1. only cpu can read/write ubc registers. 2. ubc cannot monitor cpu and dmac access in the same channel. 3. notes in specification of sequential break are described below: a. a condition match occurs when a channel b match occurs in a bus cycle after a channel a match occurs in another bus cycle in sequential break setting. therefore, no condition match occurs even if a bus cycle, in which a channel a match and a channel b match occur simultaneously, is set. b. since the cpu has a pipeline configuration, the pipeline determines the order of an instruction fetch cycle and a memory cycle. therefore, when a channel condition matches in the order of bus cycles, a sequential condition is satisfied. c. when the bus cycle condition for channel a is specified as a break before execution (pcba = 0 in brcr) and an instruction fetch cycle (in bbra), the attention is as follows. a break is issued and condition match flags in brcr are set to 1, when the bus cycle conditions both for channels a and b match simultaneously.
rev. 4.00, 03/04, page 157 of 660 4. the change of a ubc register value is executed in ma (memory access) stage. therefore, even if the break condition matches in the instruction fetch address following the instruction in which the pre-execution break is specified as the break condition, no break occurs. in order to know the timing ubc register is changed, read the last written register. instructions after then are valid for the newly written register value. 5. the branch instruction should not be executed as soon as pc trace register brsr and brdr are read. 6. when pc breaks and tlb exceptions or errors occur in the same instruction. the priority is as follows: a. break and instruction fetch exceptions: instruction fetch exception occurs first. b. break before execution and operand exception: break before execution occurs first. c. break after execution and operand exception: operand exception occurs first.
rev. 4.00, 03/04, page 158 of 660
rev. 4.00, 03/04, page 159 of 660 section 8 bus state controller (bsc) the bus state controller (bsc) divides physical address space and output control signals for various types of memory and bus interface specifications. bsc functions enable this lsi to link directly with dram, synchronous dram, sram, rom, and other memory storage devices without an external circuit. the bsc also allows direct connection to pcmcia interfaces, simplifying system design and allowing high-speed data transfers in a compact system. figure 8.1 shows the block diagram of the bsc. 8.1 feature the bsc has the following features: ? physical address space is divided into six areas ? a maximum 64 mbytes for each of the six areas, 0, 2 to 6 ? area bus width can be selected by register (area 0 is set by external pin) ? wait states can be inserted using the wait pin ? wait state insertion can be controlled through software. register settings can be used to specify the insertion of 1 to 10 cycles independently for each area (1 to 38 cycles for areas 5 and 6 and the pcmciat interface only) ? the type of memory connected can be specified for each area, and control signals are output for direct memory connection ? wait cycles are automatically inserted to avoid data bus conflict for continuous memory accesses to different areas or writes directly following reads of the same area ? direct interface to synchronous dram (except when clock ratio becomes i :b =1:1) ? multiplexes row/column addresses according to synchronous dram capacity ? supports burst operation ? supports bank active mode ? has both auto-refresh and self-refresh functions ? controls timing of synchronous dram direct-connection control signals according to register setting ? burst rom interface ? insertion of wait states controllable through software ? register setting control of burst transfers ? pcmcia direct-connection interface ? insertion of wait states controllable through software ? bus sizing function for i/o bus width (only in the little endian mode)
rev. 4.00, 03/04, page 160 of 660 ? refresh function ? refresh cycles will be automatically maintained in the sleep mode even after the external bus frequency is reduced to 1/4 of its normal operating frequency ? the refresh counter can be used as an interval timer ? outputs an interrupt request signal using the compare-matching function ? outputs an interrupt request signal when the refresh counter overflows wcr1 wcr2 bcr1 module bus mcr bsc rfcr rtcnt comparator refresh controller peripheral bus internal bus interrupt controller memory controller area controller wait controller , to , , rd/ to cke , wcr bcr mcr pcr legend bus interface rtcsr rtcor bcr2 pcr : wait state control register : bus control register : memory control register : pcmcia control register rfcr rtcnt rtcor rtcsr : refresh count register : refresh timer count register : refresh time constant register : refresh timer control/status register figure 8.1 bsc functional block diagram
rev. 4.00, 03/04, page 161 of 660 8.2 input/output pin table 8.1 lists the bsc pin configuration. table 8.1 pin configuration pin name signal i/o description address bus a25 to a0 o address output d15 to d0 i/o data i/o data bus d31 to d16 i/o when 32-bit bus width, data i/o bus cycle start bs o shows start of bus cycle. during burst transfers, asserts every data cycle. chip select 0, 2 to 4 cs0 , cs2 to cs4 o chip select signal to indicate area being accessed. chip select 5, 6 cs5 / ce1a , cs6 / ce1b o chip select signal to indicate area being accessed. cs5 / ce1a and cs6 / ce1b canalsobeusedas ce1a and ce1b of pcmcia. pcmcia card select ce2a , ce2b o when pcmcia is used, ce2a and ce2b read/write rd/ wr o data bus direction indicator signal. synchronous dram write indicator signal. row address strobe l rasl o when synchronous dram is used, rasl for lower 32- mbyte address. row address strobe u rasu o when synchronous dram is used, rasu for upper 32- mbyte address. column address strobe casl o when synchronous dram is used, casl signal for lower 32-mbyte address. column address strobe casu o when synchronous dram is used, casu signal for upper 32-mbyte address. data enable 0 we0 / dqmll o when memory other than synchronous dram is used, selects d7 to d0 write strobe signal. when synchronous dram is used, selects d7 to d0. data enable 1 we1 / dqmlu / we o when memory other than synchronous dram is used, selects d15 to d8 write strobe signal. when synchronous dram is used, selects d15 to d8. when pcmcia is used, strobe signal that indicates the write cycle. data enable 2 we2 / dqmul / iciord o when memory other than synchronous dram is used, selects d23 to d16 write strobe signal. when synchronous dram is used, selects d23 to d16. when pcmcia is used, strobe signal indicating i/o read.
rev. 4.00, 03/04, page 162 of 660 pin name signal i/o description data enable 3 we3 / dqmuu / iciowr o when memory other than synchronous dram is used, selects d31 to d24 write strobe signal. when synchronous dram is used, selects d31 to d24. when pcmcia is used, strobe signal indicating i/o write. read rd o strobe signal indicating read cycle wait wait i wait state request signal clock enable cke o clock enable control signal of synchronous dram iois16 iois16 i signal indicating pcmcia 16-bit i/o. valid only in little- endian mode. bus release request breq i bus release request signal bus release acknowledgment back o bus release acknowledge signal 8.3 area overview space allocation: in the architecture of this lsi, both logical spaces and physical spaces have 32- bit address spaces. the logical space is divided into five areas by the value of the upper bits of the address. the physical space is divided into eight areas. logical space can be allocated at physical spaces using a memory management unit (mmu). for details, refer to section 3, memory management unit (mmu), which describes area allocation for physical spaces. as listed in table 8.2, this lsi can be connected directly to six areas of memory/pcmcia interface, and it outputs chip select signals ( cs0 , cs2 to cs6 , ce2a , ce2b ) for each of them. cs0 is asserted during area 0 access; cs6 is asserted during area 6 access. when pcmcia interface is selected in area 5 or 6, in addition to cs5 / cs6 , ce2a / ce2b are asserted for the corresponding bytes accessed.
rev. 4.00, 03/04, page 163 of 660 area 0 (cs0) internal i/o area 2 (cs2) area 3 (cs3) area 4 (cs4) area 5 (cs5) area 6 (cs6) h'00000000 h'20000000 h'40000000 h'60000000 h'80000000 h'a0000000 h'c0000000 h'e0000000 h'00000000 h'04000000 h'08000000 h'0c000000 h'10000000 h'14000000 h'18000000 reserved area physical address space logical address space p0, u0 p1 p2 p3 p4 note: for logical address spaces p0 and p3, when the memory management unit (mmu) is on, it can optionally generate a physical address for the logical address. it can be applied when the mmu is off and when the mmu is on and each physical address for the logical address is equal except for upper three bits. see table 8.2, for information on converting logical addresses into user-defined physical addresses. figure 8.2 corresponding to logical address space and physical address space table 8.2 physical address space map area connectable memory physical address capacity access size h'00000000 to h'03ffffff 64 mbytes 8, 16, 32 * 2 0 ordinary memory * 1 , burst rom h'00000000 + h'20000000 nto h'03ffffff + h'20000000 n shadow n: 1 to 6 h'04000000 to h'07ffffff 64 mbytes 8, 16, 32 * 3 1 internal i/o registers * 8 h'04000000 + h'20000000 nto h'07ffffff + h'20000000 n shadow n: 1 to 6 h'08000000 to h'0bffffff 64 mbytes 8, 16, 32 * 3 * 4 2 ordinary memory * 1 , synchronous dram h'08000000 + h'20000000 nto h'0bffffff + h'20000000 n shadow n: 1 to 6 h'0c000000 to h'0fffffff 64 mbytes 8, 16, 32 * 3 * 5 3 ordinary memory * 1 , synchronous dram h'0c000000 + h'20000000 nto h'0fffffff + h'20000000 n shadow n: 1 to 6 h'10000000 to h'13ffffff 64 mbytes 8, 16, 32 * 3 4 ordinary memory * 1 h'10000000 + h'20000000 nto h'13ffffff + h'20000000 n shadow n: 1 to 6
rev. 4.00, 03/04, page 164 of 660 area connectable memory physical address capacity access size h'14000000 to h'15ffffff 32 mbytes h'16000000 to h'17ffffff 32 mbytes 8, 16, 32 * 3 * 6 5 ordinary memory * 1 , pcmcia, burst rom h'14000000 + h'20000000 nto h'17ffffff + h'20000000 n shadow n: 1 to 6 h'18000000 to h'19ffffff h'1a000000 to h'1bffffff 32 mbytes 8, 16, 32 * 3 * 6 6 ordinary memory * 1 , pcmcia, burst rom h'18000000 + h'20000000 nto h'1bffffff + h'20000000 n shadow n: 1 to 6 7 * 7 reserved area h'1c000000 + h'20000000 n to h'1fffffff + h'20000000 n n: 0 to 7 notes: 1. memory with interface such as sram or rom. 2. use external pin to specify memory bus width. 3. use register to specify memory bus width. 4. with synchronous dram interfaces, bus width must be 16 or 32 bits. 5. with synchronous dram interfaces, bus width must be 16 or 32 bits. 6. with pcmcia interface, bus width must be 8 or 16 bits. 7. do not access the reserved area. if the reserved area is accessed, the correct operation cannot be guaranteed. 8. when the control register in area 1 is not used for address translation by the mmu, set the top three bits of the logical address to 101 to allocate in the p2 space. area 0: h'00000000 area 1: h'04000000 area 2: h'08000000 area 3: h'0c000000 area 4: h'10000000 area 5: h'14000000 the pcmcia interface is shared by the memory and i/o card the pcmcia interface is shared by the memory and i/o card area 6: h'18000000 ordinary memory/ burst rom internal i/o ordinary memory/ synchronous dram ordinary memory/ synchronous dram ordinary memory ordinary memory/ burst rom/pcmcia ordinary memory/ burst rom/pcmcia figure 8.3 physical space allocation
rev. 4.00, 03/04, page 165 of 660 memory bus width: the memory bus width in this lsi can be set for each area. in area 0, an external pin can be used to select byte (8 bits), word (16 bits), or longword (32 bits) on power-on reset. the correspondence between the external pins (md4 and md3) and memory size is listed in table below. table 8.3 correspondence between external pins (md4 and md3) and memory size md4 md3 memory size 0 0 reserved (setting prohibited) 018bits 1016bits 1132bits for areas 2 to 6, byte, word, and longword may be chosen for the bus width using bus control register 2 (bcr2) whenever ordinary memory, rom, or burst rom are used. when the synchronous dram interface is used, word or longword can be chosen as the bus width. when the pcmcia interface is used, set the bus width to byte or word. when synchronous dram is connected to both area 2 and area 3, set the same bus width for areas 2 and 3. when using port a or b, set a bus width of 8 or 16 bits for all areas. for more information, see section 8.4.2, bus control register 2 (bcr2). shadow space: areas 0, 2 to 6 are decoded by physical addresses a28 to a26, which correspond to areas 000 to 110. address bits 31 to 29 are ignored. this means that the range of area 0 addresses, for example, is h'00000000 to h'03ffffff, and its corresponding shadow space is the address space obtained by adding to it h'20000000 n(n = 1 to 6). the address range for area 7, which is on-chip i/o space, is h'1c000000 to h'1fffffff. the address space h'1c000000 + h'20000000 n?h'1fffffff + h'20000000 n(n = 0 to 7) corresponding to the area 7 shadow space is reserved, so do not use it. 8.3.1 pcmcia support this lsi supports pcmcia standard interface specifications in physical space areas 5 and 6 (except for wp). the interfaces supported are basically the "ic memory card interface" and "i/o card interface" stipulated in jeida specifications ver. 4.2 (pcmcia2.1).
rev. 4.00, 03/04, page 166 of 660 table 8.4 pcmcia interface characteristics item feature access random access data bus 8/16 bits memory type mask rom, otprom, eprom, eeprom, flash memory, sram memory capacity maximum 32 mbytes i/o space capacity maximum 32 mbytes others dynamic bus sizing of i/o bus width * the pcmcia interface can be accessed from the address translation area or non-address translation area. note: * dynamic bus sizing of i/o bus width is supported only in the little endian mode. commom memory/attribute memory area 5: h'14000000 area 5: h'16000000 commom memory/attribute memory area 6: h'18000000 i/o space i/o space area 6: h'1a000000 figure 8.4 pcmcia space allocation table 8.5 pcmcia support interface ic memory card interface i/o card interface pin signal i/o function signal i/o function sh7706 pin 1 gnd ? ground gnd ? ground ? 2 d3 i/o data d3 i/o data d3 3 d4 i/o data d4 i/o data d4 4 d5 i/o data d5 i/o data d5 5 d6 i/o data d6 i/o data d6 6 d7 i/o data d7 i/o data d7 7 ce1 i card enable ce1 i card enable ce1a or ce1b 8 a10 i address a10 i address a10 9 oe i output enable oe i output enable rd 10 a11 i address a11 i address a11
rev. 4.00, 03/04, page 167 of 660 ic memory card interface i/o card interface pin signal i/o function signal i/o function sh7706 pin 11 a9 i address a9 i address a9 12 a8 i address a8 i address a8 13 a13 i address a13 i address a13 14 a14 i address a14 i address a14 15 we / pgm i write enable we / pgm i write enable we 16 rdy/ bsy o ready/busy ireq o ready/busy ? 17 v cc operation power v cc operation power ? 18 v pp1 program power v pp1 program/ peripheral power ? 19 a16 i address a16 i address a16 20 a15 i address a15 i address a15 21 a12 i address a12 i address a12 22 a7 i address a7 i address a7 23 a6 i address a6 i address a6 24 a5 i address a5 i address a5 25 a4 i address a4 i address a4 26 a3 i address a3 i address a3 27 a2 i address a2 i address a2 28 a1 i address a1 i address a1 29 a0 i address a0 i address a0 30 d0 i/o data d0 i/o data d0 31 d1 i/o data d1 i/o data d1 32 d2 i/o data d2 i/o data d2 33 wp * o write protect iois16 o 16-bit i/o port iois16 34 gnd ground gnd ground ? 35 gnd ground gnd ground ? 36 cd1 o card detection cd1 o card detection ? 37 d11 i/o data d11 i/o data d11 38 d12 i/o data d12 i/o data d12 39 d13 i/o data d13 i/o data d13 40 d14 i/o data d14 i/o data d14
rev. 4.00, 03/04, page 168 of 660 ic memory card interface i/o card interface pin signal i/o function signal i/o function sh7706 pin 41 d15 i/o data d15 i/o data d15 42 ce2 i card enable ce2 i card enable ce2a or ce2b 43 vs1 i voltage sense 1 vs1 i voltage sense 1 ? 44 rfu reserved iord i i/o read iciord 45 rfu reserved iowr i i/o write iciowr 46 a17 i address a17 i address a17 47 a18 i address a18 i address a18 48 a19 i address a19 i address a19 49 a20 i address a20 i address a20 50 a21 i address a21 i address a21 51 v cc power supply v cc power supply ? 52 v pp2 program power v pp2 program/ peripheral power ? 53 a22 i address a22 i address a22 54 a23 i address a23 i address a23 55 a24 i address a24 i address a24 56 a25 i address a25 i address a25 57 vs2 i voltage sense 2 vs2 i voltage sense 2 ? 58 reset i reset reset i reset ? 59 wait o wait request wait o wait request ? 60 rfu reserved inpack o input acknowledge ? 61 reg i attribute memory space select reg i attribute memory space select ? 62 bvd2 o battery voltage detection spkr o digital voice signal ? 63 bvd1 o battery voltage detection stschg ocardstate change ? 64 d8 i/o data d8 i/o data d8 65 d9 i/o data d9 i/o data d9 66 d10 i/o data d10 i/o data d10 67 cd2 o card detection cd2 o card detection ? 68 gnd ground gnd ground ? note: * this lsi does not support wp.
rev. 4.00, 03/04, page 169 of 660 8.4 register description the bsc has 11 registers. the synchronous dram also has a built-in synchronous dram mode register. these registers control direct connection interfaces to memory, wait states and refreshes. refer to section 23, list of registers, for more details of the addresses and access sizes. ? bus control register 1 (bcr1) ? bus control register 2 (bcr2) ? wait state control register 1 (wcr1) ? wait state control register 2 (wcr2) ? individual memory control register (mcr) ? pcmcia control register (pcr) ? synchronous dram mode register (sdmr) ? refresh timer control/status register (rtcsr) ? refresh timer counter (rtcnt) ? refresh time constant register (rtcor) ? refresh count register (rfcr) 8.4.1 bus control register 1 (bcr1) bus control register 1 (bcr1) is a 16-bit read/write register that sets the functions and bus cycle state for each area. it is initialized to h'0000 by a power-on reset, but is not initialized by a manual reset or by standby mode. do not access external memory outside area 0 until bcr1 register initialization is complete. bit bit name initial value r/w description 15 pula 0 r/w pin a25 to a0 pull-up specifies whether or not pins a25 to a0 are pulled up for 4 cycles immediately after back is asserted. 0: not pulled up 1: pulled up 14 puld 0 r/w pin d31 to d0 pull-up specifies whether or not pins d31 to d0 are pulled up when not in use. 0: not pulled up 1: pulled up
rev. 4.00, 03/04, page 170 of 660 bit bit name initial value r/w description 13 hizmem 0 r/w hi-z memory control specifies the state of a25 to 0, bs , cs , rd/ wr , we /dqm, rd , ce2a , ce2b and drak0/1 in standby mode. 0: high-impedance state in standby mode. 1: driven in standby mode. 12 hizcnt 0 r/w high-z control specifies the state of the ras and the cas signals at standby and bus right release. 0: high-impedance state at standby and bus right release. 1: driven at standby and bus right release. 11 endian 0/1 * 1 r endian flag samples the value of the external pin designating endian upon a power-on reset. endian for all physical spaces is decided by this bit, which is read-only. 0: (on reset) endian setting external pin (md5) is low. indicates the sh7706 is set as big endian. 1: (on reset) endian setting external pin (md5) is high. indicates the sh7706 is set as little endian. 10 9 a0bst1 a0bst0 0 0 r/w r/w area 0 burst rom control specify whether to use burst rom in physical space area 0. when burst rom is used, set the number of burst transfers. 00: access area 0 as ordinary memory 01: access area 0 as burst rom (4 consecutive accesses). can be used when bus width is 8, 16, or 32. 10: access area 0 as burst rom (8 consecutive accesses). can be used when bus width is 8 or 16. 01: access area 0 as burst rom (16 consecutive accesses). can be used only when bus width is 8.
rev. 4.00, 03/04, page 171 of 660 bit bit name initial value r/w description 8 7 a5bst1 a5bst0 0 0 r/w r/w area 5 burst enable specify whether to use burst rom and pcmcia burst mode in physical space area 5. when burst rom and pcmcia burst mode are used, set the number of burst transfers. 00: access area 5 as ordinary memory 01: burst access of area 5 (4 consecutive accesses). can be used when bus width is 8, 16, or 32. 10: burst access of area 5 (8 consecutive accesses). can be used when bus width is 8 or 16. 11: burst access of area 5 (16 consecutive accesses). can be used only when bus width is 8. 6 5 a6bst1 a6bst0 0 0 r/w r/w area 6 burst enable specify whether to use burst rom and pcmcia burst mode in physical space area 6. when burst rom and pcmcia burst mode are used, set the number of burst transfers. 00: access area 6 as ordinary memory 01: burst access of area 6 (4 consecutive accesses). can be used when bus width is 8, 16, or 32. 10: burst access of area 6 (8 consecutive accesses). can be used when bus width is 8 or 16. 11: burst access of area 6 (16 consecutive accesses). can be used only when bus width is 8. 4 3 2 dramtp2 dramtp1 dramtp0 0 0 0 r/w r/w r/w area 2, area 3 memory type designate the types of memory connected to physical space areas 2 and 3. ordinary memory, such as rom, sram, or flash rom, can be directly connected. synchronous dram can also be directly connected. 000: areas 2 and 3 are ordinary memory 001: reserved (setting prohibited) 010: area 2: ordinary memory; area 3: synchronous dram * 3 011: areas 2 and 3 are synchronous dram * 2 * 3 100: reserved (setting prohibited) 101: reserved (setting prohibited) 110: reserved (setting prohibited) 111: reserved (setting prohibited)
rev. 4.00, 03/04, page 172 of 660 bit bit name initial value r/w description 1 a5pcm 0 r/w area 5 bus type designates whether to access physical space area 5 as pcmcia space. 0: access physical space area 5 as ordinary memory 1: access physical space area 5 as pcmcia space 0 a6pcm 0 r/w area 6 bus type designates whether to access physical space area 6 as pcmcia space. 0: access physical space area 6 as ordinary memory 1: access physical space area 6 as pcmcia space notes: 1. samples the value of the external pin (md5) designating endian at power-on reset. 2. when selecting this mode, set the same bus width for areas 2 and 3. 3. do not access to the sram when the clock ratio is i :b =1:1. 8.4.2 bus control register 2 (bcr2) the bus control register 2 (bcr2) is a 16-bit read/write register that selects the bus-size width and 8-bit port of each area. it is initialized to h'3ff0 by a power-on reset, but is not initialized by a manual reset or by standby mode. do not access external memory outside area 0 until bcr2 register initialization is complete. bit bit name initial value r/w description 15, 14 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 13 12 a6sz1 a6sz0 1 1 r/w r/w area 6 bus size specification specify the bus sizes of physical space area 6. ? when port a/b is unused. 00: reserved (setting prohibited) 01: byte (8-bit) size 10: word (16-bit) size 11: longword (32-bit) size ? when port a/b is used. 00: reserved (setting prohibited) 01: byte (8-bit) size 10: word (16-bit) size 11: reserved (setting prohibited)
rev. 4.00, 03/04, page 173 of 660 bit bit name initial value r/w description 11 10 a5sz1 a5sz0 1 1 r/w r/w area 5 bus size specification specify the bus sizes of physical space area 5. ? when port a/b is unused. 00: reserved (setting prohibited) 01: byte (8-bit) size 10: word (16-bit) size 11: longword (32-bit) size ? when port a/b is used. 00: reserved (setting prohibited) 01: byte (8-bit) size 10: word (16-bit) size 11: reserved (setting prohibited) 9 8 a4sz1 a4sz0 1 1 r/w r/w area 4 bus size specification specify the bus sizes of physical space area 4. ? when port a/b is unused. 00: reserved (setting prohibited) 01: byte (8-bit) size 10: word (16-bit) size 11: longword (32-bit) size ? when port a/b is used. 00: reserved (setting prohibited) 01: byte (8-bit) size 10: word (16-bit) size 11: reserved (setting prohibited) 7 6 a3sz1 a3sz0 1 1 r/w r/w area 3 bus size specification specify the bus sizes of physical space area 3. ? when port a/b is unused. 00: reserved (setting prohibited) 01: byte (8-bit) size 10: word (16-bit) size 11: longword (32-bit) size ? when port a/b is used. 00: reserved (setting prohibited) 01: byte (8-bit) size 10: word (16-bit) size 11: reserved (setting prohibited)
rev. 4.00, 03/04, page 174 of 660 bit bit name initial value r/w description 5 4 a2sz1 a2sz0 1 1 r/w r/w area 2 bus size specification specify the bus sizes of physical space area 2. ? when port a/b is unused. 00: reserved (setting prohibited) 01: byte (8-bit) size 10: word (16-bit) size 11: longword (32-bit) size ? when port a/b is used. 00: reserved (setting prohibited) 01: byte (8-bit) size 10: word (16-bit) size 11: reserved (setting prohibited) 3to0 ? all0 r reserved these bits are always read as 0. the write value should always be 0. 8.4.3 wait state control register 1 (wcr1) wait state control register 1 (wcr1) is a 16-bit read/write register that specifies the number of idle (wait) state cycles inserted for each area. for some memories, the drive of the data bus may not be turned off quickly even when the read signal from the external device is turned off. this can result in conflicts between data buses when consecutive memory accesses are to different memories or when a write immediately follows a memory read. this lsi automatically inserts idle states equal to the number set in wcr1 in those cases. wcr1 is initialized to h'3ff3 by a power-on reset. it is not initialized by a manual reset or by standby mode. bit bit name initial value r/w description 15 waitsel 0 r/w wait sampling timing select specifies the wait signal sampling timing. 0: set 1 to use the wait signal. 1: the wait signal is sampled at the falling edge of ckio. 14 ? 0 r reserved these bits are always read as 0. the write value should always be 0.
rev. 4.00, 03/04, page 175 of 660 bit bit name initial value r/w description 13 12 a6iw1 a6iw0 1 1 r/w r/w area 6 intercycle idle specification specify the number of idles inserted between bus cycles when switching between physical space area 6 to another space or between a read access to a write access in the same physical space. 00: 1 idle cycle inserted 01: 1 idle cycle inserted 10: 2 idle cycles inserted 11: 3 idle cycles inserted 11 10 a5iw1 a5iw0 1 1 r/w r/w area 5 intercycle idle specification specify the number of idles inserted between bus cycles when switching between physical space area 5 to another space or between a read access to a write access in the same physical space. 00: 1 idle cycle inserted 01: 1 idle cycle inserted 10: 2 idle cycles inserted 11: 3 idle cycles inserted 9 8 a4iw1 a4iw0 1 1 r/w r/w area 4 intercycle idle specification specify the number of idles inserted between bus cycles when switching between physical space area 4 to another space or between a read access to a write access in the same physical space. 00: 1 idle cycle inserted 01: 1 idle cycle inserted 10: 2 idle cycles inserted 11: 3 idle cycles inserted 7 6 a3iw1 a3iw0 1 1 r/w r/w area 3 intercycle idle specification specify the number of idles inserted between bus cycles when switching between physical space area 3 to another space or between a read access to a write access in the same physical space. 00: 1 idle cycle inserted 01: 1 idle cycle inserted 10: 2 idle cycles inserted 11: 3 idle cycles inserted
rev. 4.00, 03/04, page 176 of 660 bit bit name initial value r/w description 5 4 a2iw1 a2iw0 1 1 r/w r/w area 2 intercycle idle specification specify the number of idles inserted between bus cycles when switching between physical space area 2 to another space or between a read access to a write access in the same physical space. 00: 1 idle cycle inserted 01: 1 idle cycle inserted 10: 2 idle cycles inserted 11: 3 idle cycles inserted 3, 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 0 a0iw1 a0iw0 1 1 r/w r/w area 0 intercycle idle specification specify the number of idles inserted between bus cycles when switching between physical space area 0 to another space or between a read access to a write access in the same physical space. 00: 1 idle cycle inserted 01: 1 idle cycle inserted 10: 2 idle cycles inserted 11: 3 idle cycles inserted
rev. 4.00, 03/04, page 177 of 660 8.4.4 wait state control register 2 (wcr2) wait state control register 2 (wcr2) is a 16-bit read/write register that specifies the number of wait state cycles inserted for each area. it also specifies the pitch of data access for burst memory accesses. this allows direct connection of even low-speed memories without an external circuit. bit bit name initial value r/w description 15 14 13 a6w2 a6w1 a6w0 1 1 1 r/w r/w r/w area 6 wait control specify the number of wait states inserted into physical space area 6. also specify the burst pitch for burst transfer. refer to table 8.6 for details. 12 11 10 a5w2 a5w1 a5w0 1 1 1 r/w r/w r/w area 5 wait control specify the number of wait states inserted into physical space area 5. also specify the burst pitch for burst transfer. refer to table 8.7 for details. 9 8 7 a4w2 a4w1 a4w0 1 1 1 r/w r/w r/w area 4 wait control specify the number of wait states inserted into physical space area 4. refer to table 8.8 for details. 6 5 a3w1 a3w0 1 1 r/w r/w area 3 wait control specify the number of wait states inserted into physical space area 3. ? for ordinary memory inserted wait states wait pin 00: 0 ignored 01: 1 enable 10: 2 enable 11: 3 enable ? for synchronus dram synchronus dram :cas latency 00: 1 01: 1 10: 2 11: 3
rev. 4.00, 03/04, page 178 of 660 bit bit name initial value r/w description 4 3 a2w1 a2w0 1 1 r/w r/w area 2 wait control specify the number of wait states inserted into physical space area 2. ? for ordinary memory inserted wait states wait pin 00: 0 ignored 01: 1 enabled 10: 2 enabled 11: 3 enabled ? for synchronus dram synchronus dram :cas latency 00: 1 01: 1 10: 2 11: 3 2 1 0 a0w2 a0w1 a0w0 1 1 1 r/w r/w r/w area 0 wait control specify the number of wait states inserted into physical space area 0. also specify the burst pitch for burst transfer. refer to table 8.9 for details. table 8.6 area 6 wait control description wcr2's bits first cycle burst cycle (excluding first cycle) bit 15: a6w2 bit 14: a6w1 bit 13: a6w0 inserted wait states wait wait wait wait pin number of states per data transfer wait wait wait wait pin 0 0 ignored 2 enable 0 1 1 enable 2 enable 0 2 enable 3 enable 0 1 1 3 enable 4 enable 0 4 enable 4 enable 0 1 6 enable 6 enable 0 8 enable 8 enable 1 1 1 10 enable 10 enable
rev. 4.00, 03/04, page 179 of 660 table 8.7 area 5 wait control description wcr2's bits first cycle burst cycle (excluding first cycle) bit 12: a5w2 bit 11: a5w1 bit 10: a5w0 inserted wait states wait wait wait wait pin number of states per data transfer wait wait wait wait pin 0 0 ignored 2 enable 0 1 1 enable 2 enable 0 2 enable 3 enable 0 1 1 3 enable 4 enable 0 4 enable 4 enable 0 1 6 enable 6 enable 0 8 enable 8 enable 1 1 1 10 enable 10 enable table 8.8 area 4 wait control wcr2's bits description bit 9: a4w2 bit 8: a4w1 bit 7: a4w0 inserted wait state wait wait wait wait pin 0 0 ignored 0 1 1 enable 0 2 enable 0 1 1 3 enable 0 4 enable 0 1 6 enable 0 8 enable 1 1 1 10 enable
rev. 4.00, 03/04, page 180 of 660 table 8.9 area 0 wait control description wcr2's bits first cycle burst cycle (excluding first cycle) bit 2: a0w2 bit 1: a0w1 bit 0: a0w0 inserted wait states wait wait wait wait pin number of states per data transfer wait wait wait wait pin 0 0 ignored 2 enable 0 1 1 enable 2 enable 0 2 enable 3 enable 0 1 1 3 enable 4 enable 0 4 enable 4 enable 0 1 6 enable 6 enable 0 8 enable 8 enable 1 1 1 10 enable 10 enable 8.4.5 individual memory control register (mcr) the individual memory control register (mcr) is a 16-bit read/write register that specifies ras and cas timing and burst control for synchronous dram (areas 2 and 3), specifies address multiplexing, and controls refresh. this enables direct connection of synchronous dram without external circuits. the mcr is initialized to h'0000 by power-on resets, but is not initialized by manual resets or standby mode. the bits tpc1, tpc0, rcd1, rcd0, trwl1, trwl0, tras1, tras0, rasd and amx3 to amx0 are written to at the initialization after a power-on reset and are not then modified again. when rfsh and rmode are written to, write the same values to the other bits. when using synchronous dram, do not access areas 2 and 3 until this register is initialized.
rev. 4.00, 03/04, page 181 of 660 bit bit name initial value r/w description 15 14 tpc1 tpc0 0 0 r/w r/w ras precharge time when synchronous dram interface is selected as connected memory, they set the minimum number of cycles until output of the next bank-active command after precharge. the number of cycles to be inserted immediately after issuing a precharge all banks (pall) command in auto-refresh or a precharge (pre) command in bank-active mode is one cycle less than the normal value. in bank-active mode, neither tpc1 nor tpc0 should be cleared to 0. immediately after * immediately normal precharge after operation command self-refresh 00: 1 cycle 0 cycle 2 cycles 01: 2 cycles 1 cycle 5 cycles 10: 3 cycles 2 cycles 8 cycles 11: 4 cycles 3 cycles 11 cycles note: * immediately after a precharge all banks (pall) command in auto-refresh and a precharge (pre) command in bank-active mode. 13 12 rcd1 rcd0 0 0 r/w r/w ras-cas delay when synchronous dram interface is selected as connected memory, sets the bank active read/write command delay time. 00: 1 cycle 01: 2 cycles 10: 3 cycles 11: 4 cycles
rev. 4.00, 03/04, page 182 of 660 bit bit name initial value r/w description 11 10 trwl1 trwl0 0 0 r/w r/w write-precharge delay the trwl bits set the synchronous dram write- precharge delay time. this designates the time between the end of a write cycle and the next bank-active command. this is valid only when synchronous dram is connected. after the write cycle, the next bank-active command is not issued for the period tpc + trwl. 00: 1 cycle 01: 2 cycles 10: 3 cycles 11: reserved (setting prohibited) 9 8 tras1 tras0 0 0 r/w r/w cas -before- ras refresh ras assert time when synchronous dram interface is selected as connected memory, no bank-active command is issues during the period tpc + tras after an auto-refresh command. 00: 2 cycles 01: 3 cycles 10: 4 cycles 11: 5 cycles 7 rasd 0 r/w synchronous dram bank active specifies whether synchronous dram is used in bank active mode or auto-precharge mode. when both areas 2 and 3 are to be connected to synchronous dram, select auto-precharge mode. 0: auto-precharge mode 1: bank active mode
rev. 4.00, 03/04, page 183 of 660 bit bit name initial value r/w description 6 5 4 3 amx3 amx2 amx1 amx0 0 0 0 0 r/w r/w r/w r/w address multiplex the amx bits specify address multiplexing for synchronous dram. the actual address shift value differs between dram interface and synchronous dram interface. for synchronous dram interface: 0000: reserved (setting prohibited) 0001: reserved (setting prohibited) 0010: reserved (setting prohibited) 0011: reserved (setting prohibited) 0100: the row address begins with a9. (the a9 value is output at a1 when the row address is output. 64 m (1 m 16 bits 4 banks)) 0101: the row address begins with a10. (the a10 value is output at a1 when the row address is output. 128 m (2 m 16 bits 4 banks), 64 m (2 m 8bits 4banks)) 0110: cannot be set. 0111: the row address begins with a9. (the a9 value is output at a1 when the row address is output. 64 m (512 k 32 bits 4 banks) * 2 ) 1000: reserved (setting prohibited) 1001: reserved (setting prohibited) 1010: reserved (setting prohibited) 1011: reserved (setting prohibited) 1100: reserved (setting prohibited) 1101: the row address begins with a10. (the a10 value is output at a1 when the row address is output. 256 m (4 m 16 bits 4 banks)) 1110: the row address begins with a11. (the a11 value is output at a1 when the row address is output. 512 m (8 m 16 bits 4 banks) * 1 ) 1111: reserved (setting prohibited) notes: 1. cannot be set when using a 32-bit bus width. 2. cannot be set when using a 16-bit bus width.
rev. 4.00, 03/04, page 184 of 660 bit bit name initial value r/w description 2 rfsh 0 r/w refresh control the rfsh bit determines whether or not the refresh operation of the dram and synchronous dram is performed. the timer for generation of the refresh request frequency can also be used as an interval timer. 0: no refresh 1: refresh 1 rmode 0 r/w refresh mode the rmode bit selects whether to perform an ordinary refresh or a self-refresh when the rfsh bit is 1. when the rfsh bit is 1 and this bit is 0, a cas-before-ras refresh or an auto-refresh is performed on synchronous dram at the period set by the refresh-related registers rtcnt, rtcor and rtcsr. when a refresh request occurs during an external bus cycle, the bus cycle will be ended and the refresh cycle performed. when the rfsh bit is 1 and this bit is also 1, the synchronous dram will wait for the end of any executing external bus cycle before going into a self-refresh. all refresh requests to memory that is in the self-refresh state are ignored. 0: cas-before-ras refresh (rfsh must be 1) 1: self-refresh (rfsh must be 1) 0? 0 r/wreserved this bit is always read as 0. the write value should always be 0.
rev. 4.00, 03/04, page 185 of 660 8.4.6 pcmcia control register (pcr) the pcmcia control register (pcr) is a 16-bit read/write register that specifies the timing for the assertion or negation of the oe and we signals for the pcmcia interface connected to areas 5 and 6. the width for assertion of the oe and we signals is set by the wait control bit in the wcr2 register. bit * bit name initial value r/w description 15 a6w3 0 r/w area 6 wait control the a6w3 bit specifies the number of inserted wait states for area 6 combined with bits a6w2 to a6w0 in wcr2. it also specifies the number of transfer states in burst transfer. set this bit to 0 when area 6 is not set to pcmcia. refer to table 8.10 for details. 14 a5w3 0 r/w area 5 wait control the a5w3 bit specifies the number of inserted wait states for area 5 combined with bits a5w2 to a5w0 in wcr2. it also specifies the number of transfer states in burst transfer. set this bit to 0 when area 5 is not set to pcmcia. the relationship between the setting value and the number of waits is the same as a6w3. 13, 12 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 11 7 6 a5ted2 a5ted1 a5ted0 0 0 0 r/w r/w r/w area5address oe / we assert delay the a5ted bits specify the address to oe / we assert delay time for the pcmcia interface connected to area 5. 000: 0.5-cycle delay 001: 1.5-cycle delay 010: 2.5-cycle delay 011: 3.5-cycle delay 100: 4.5-cycle delay 101: 5.5-cycle delay 110: 6.5-cycle delay 111: 7.5-cycle delay
rev. 4.00, 03/04, page 186 of 660 bit * bit name initial value r/w description 10 5 4 a6ted2 a6ted1 a6ted0 0 0 0 r/w r/w r/w area6address oe / we assert delay the a6ted bits specify the address to oe / we assert delay time for the pcmcia interface connected to area 6. 000: 0.5-cycle delay 001: 1.5-cycle delay 010: 2.5-cycle delay 011: 3.5-cycle delay 100: 4.5-cycle delay 101: 5.5-cycle delay 110: 6.5-cycle delay 111: 7.5-cycle delay 9 3 2 a5teh2 a5teh1 a5teh0 0 0 0 r/w r/w r/w area 5 oe / we negate address delay the a5teh bits specify the oe / we negate address delay time for the pcmcia interface connected to area 5. 000: 0.5-cycle delay 001: 1.5-cycle delay 010: 2.5-cycle delay 011: 3.5-cycle delay 100: 4.5-cycle delay 101: 5.5-cycle delay 110: 6.5-cycle delay 111: 7.5-cycle delay 8 1 0 a6teh2 a6teh1 a6teh0 0 0 0 r/w r/w r/w area 6 oe / we negate address delay the a6teh bits specify the oe / we negate address delay time for the pcmcia interface connected to area 6. 000: 0.5-cycle delay 001: 1.5-cycle delay 010: 2.5-cycle delay 011: 3.5-cycle delay 100: 4.5-cycle delay 101: 5.5-cycle delay 110: 6.5-cycle delay 111: 7.5-cycle delay note: * the bit numbers are out of sequence.
rev. 4.00, 03/04, page 187 of 660 table 8.10 area 6 wait control description top cycle burst cycle wcr2 a6w3 a6w2 a6w1 a6w0 inserted wait state wait wait wait wait pin number of states per one-data transfer wait wait wait wait pin 0 0 0 0 0 ignored 2 enabled 0 0 0 1 1 enabled 2 enabled 0 0 1 0 2 enabled 3 enabled 0 0 1 1 3 enabled 4 enabled 0 1 0 0 4 enabled 5 enabled 0 1 0 1 6 enabled 7 enabled 0 1 1 0 8 enabled 9 enabled 0 1 1 1 10 enabled 11 enabled 1 0 0 0 12 enabled 13 enabled 1 0 0 1 14 enabled 15 enabled 1 0 1 0 18 enabled 19 enabled 1 0 1 1 22 enabled 23 enabled 1 1 0 0 26 enabled 27 enabled 1 1 0 1 30 enabled 31 enabled 1 1 1 0 34 enabled 35 enabled 1 1 1 1 38 enabled 39 enabled
rev. 4.00, 03/04, page 188 of 660 8.4.7 synchronous dram mode register (sdmr) the synchronous dram mode register (sdmr) is written to via the synchronous dram address bus and is an 8-bit write-only register. it sets synchronous dram mode for areas 2 and 3. sdmr must be set before synchronous dram is accessed. writes to the synchronous dram mode register use the address bus rather than the data bus. if the value to be set is x and the sdmr address is y, the value x is written in the synchronous dram mode register by writing in address x + y. since, with a 32-bit bus width, a0 of the synchronous dram is connected to a2 of the chip and a1 of the synchronous dram is connected to a3 of the chip, the value actually written to the synchronous dram is the x value shifted two bits right. with a 16-bit bus width, the value written is the x value shifted one bit right. for example, with a 32-bit bus width, when h'0230 is written to the sdmr register of area 2, random data is written to the address h'ffffd000 (address y) + h'08c0 (value x), or h'ffffd8c0. as a result, h'0230 is written to the sdmr register. the range for value x is h?0000 to h'0ffc. when h'0230 is written to the sdmr register of area 3, random data is written to the address h'ffffe000 (address y) + h'08c0 (value x), or h'ffffe8c0. as a result, h'0230 is written to the sdmr register. the range for value x is h'0000 to h'0ffc. 8.4.8 refresh timer control/status register (rtcsr) the refresh timer control/status register (rtcsr) is a 16-bit read/write register that specifies the refresh cycle, whether to generate an interrupt, and that interrupt's cycle. it is initialized to h'0000 by a power-on reset, but is not initialized by a manual reset or standby mode and holds its values unchanged. make the rtcor setting before setting bits cks2 to cks0 in rtcsr. note: writing to the rtcsr differs from that to general registers to ensure the rtcsr is not rewritten incorrectly. use the word-transfer instruction to set the upper byte as b'10100101 and the lower byte as the write data. for the byte-transfer instruction, writing is disabled. read data in 16 bits. 0 is read from undefined bits.
rev. 4.00, 03/04, page 189 of 660 bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 cmf 0 r/w compare match flag the cmf status flag indicates that the values of rtcnt and rtcor match. 0: the values of rtcnt and rtcor do not match. clear condition: when a refresh is performed after 0 has been written in cmf and rfsh = 1 and rmode = 0 (to perform a cbr refresh). 1: the values of rtcnt and rtcor match. set condition: rtcnt = rtcor * note: * contents don?t change when 1 is written to cmf. 6 cmie 0 r/w compare match interrupt enable enables or disables an interrupt request caused when the cmf of rtcsr is set to 1. do not set this bit to 1 when using auto-refresh. 0: disables an interrupt request caused by cmf 1: enables an interrupt request caused by cmf 5 4 3 cks2 cks1 cks0 0 0 0 r/w r/w r/w clock select bits select the clock input to rtcnt. the source clock is the external bus clock (ckio). the rtcnt count clock is ckio divided by the specified ratio. rtcor should be set before setting cks2 to cks0. 000: disables clock input 001: bus clock (ckio)/4 010: ckio/16 011: ckio/64 100: ckio/256 101: ckio/1024 110: ckio/2048 111: ckio/4096
rev. 4.00, 03/04, page 190 of 660 bit bit name initial value r/w description 2 ovf 0 r/w refresh count overflow flag the ovf status flag indicates when the number of refresh requests indicated in the refresh count register (rfcr) exceeds the limit set in the lmts bit of rtcsr. 0: rfcr has not exceeded the count limit value set in lmts clear conditions: when 0 is written to ovf 1: rfcr has exceeded the count limit value set in lmts set conditions: when the rfcr value has exceeded the count limit value set in lmts * note: * contents don't change when 1 is written to ovf. 1 ovie 0 r/w refresh count overflow interrupt enable ovie selects whether to suppress generation of interrupt requests by ovf when the ovf bit of rtcsr is set to 1. 0: disables interrupt requests from the ovf 1: enables interrupt requests from the ovf 0 lmts 0 r/w refresh count overflow limit select indicates the count limit value to be compared to the number of refreshes indicated in the refresh count register (rfcr). when the value rfcr overflows the value specified by lmts, the ovf flag is set. 0: count limit value is 1024 1: count limit value is 512
rev. 4.00, 03/04, page 191 of 660 8.4.9 refresh timer counter (rtcnt) rtcnt is a 16-bit read/write register. rtcnt is an 8-bit counter that counts up with input clocks. the clock select bits (cks2 to cks0) of rtcsr select the input clock. when rtcnt matches rtcor, the cmf bit of rtcsr is set and rtcnt is cleared. rtcnt is initialized to h'00 by a power-on reset; it continues incrementing after a manual reset; it is not initialized by standby mode and holds its values unchanged. note: writing to the rtcnt differs from that to general registers to ensure the rtcnt is not rewritten incorrectly. use the word-transfer instruction to set the upper byte as b'10100101 and the lower byte as the write data. for the byte-transfer instruction, writing is disabled. read data in 16 bits. 0 is read from undefined bits. bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. 7 to 0 ? all 0 r/w 8-bit counter 8.4.10 refresh time constant register (rtcor) the refresh time constant register (rtcor) is a 16-bit read/write register. the values of rtcor and rtcnt (bottom 8 bits) are constantly compared. when the values match, the cmf of rtcsr is set and rtcnt is cleared to 0. when the refresh bit (rfsh) of the individual memory control register (mcr) is set to 1 and the refresh mode is set to auto refresh, a memory refresh cycle occurs when the cmf bit is set. rtcor is initialized to h'00 by a power-on reset. it is not initialized by a manual reset or standby mode, but holds its contents. make the rtcor setting before setting bits cks2 to cks0 in rtcsr. note: writing to the rtcor differs from that to general registers to ensure the rtcor is not rewritten incorrectly. use the word-transfer instruction to set the upper byte as b'10100101 and the lower byte as the write data. for the byte-transfer instruction, writing is disabled. read data in 16 bits. 0 is read from undefined bits. bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. 7 to 0 ? all 0 r/w upper limit of the counter (8 bits)
rev. 4.00, 03/04, page 192 of 660 8.4.11 refresh count register (rfcr) the refresh count register (rfcr) is a 16-bit read/write register. it is a 10-bit counter that increments every time rtcor and rtcnt match. when rfcr exceeds the count limit value set in the lmts of rtcsr, rtcsr's ovf bit is set and rfcr clears. rfcr is initialized to h'0000 when a power-on reset is performed. it is not initialized by a manual reset or standby mode, but holds its contents. note: writing to the rfcr differs from that to general registers to ensure the rfcr is not rewritten incorrectly. use the word-transfer instruction to set the msb and followed six bits of upper bytes as b'101001 and remaining bits as the write data. for the byte-transfer instruction, writing is disabled. read data in 16 bits. 0 is read from undefined bits. bit bit name initial value r/w description 15 to 10 ? all 0 r reserved these bits are always read as 0. 9 to 0 ? all 0 r/w 10-bit counter 8.5 operation 8.5.1 endian/access size and data alignment this lsi supports both big endian, in which the 0 address is the most significant byte in the byte data, and little endian, in which the 0 address is the least significant byte. this switchover is designated by an external pin (md5 pin) at the time of a power-on reset. after a power-on reset, big endian is engaged when md5 is low; little endian is engaged when md5 is high. three data bus widths are available for ordinary memory (byte, word, longword) and two data bus widths (word and longword) for synchronous dram. for the pcmcia interface, choose from byte and word. this means data alignment is done by matching the device's data width and endian. the access unit must also be matched to the device's bus width. this also means that when longword data is read from a byte-width device, the read operation must happen 4 times. in this lsi, data alignment and conversion of data length is performed automatically between the respective interfaces. tables 8.11 through 8.16 show the relationship between endian, device data width, and access unit.
rev. 4.00, 03/04, page 193 of 660 table 8.11 32-bit external device/big endian access and data alignment data bus strobe signals operation d31 to d24 d23 to d16 d15 to d8 d7 to d0 we3 we3 we3 we3 , dqmuu dqmuu dqmuu dqmuu we2 we2 we2 we2 , dqmul dqmul dqmul dqmul we1 we1 we1 we1 , dqmlu dqmlu dqmlu dqmlu we0 we0 we0 we0 , dqmll dqmll dqmll dqmll byte access at 0 data 7to0 ? ? ? assert byte access at 1 ? data 7to0 ? ? assert byte access at 2 ? ? data 7to0 ? assert byte access at 3 ? ? ? data 7to0 assert word access at 0 data 15 to 8 data 7to0 ? ? assert assert word access at 2 ? ? data 15 to 8 data 7to0 assert assert longword access at 0 data 31 to 24 data 23 to 16 data 15 to 8 data 7to0 assert assert assert assert table 8.12 16-bit external device/big endian access and data alignment data bus strobe signals operation d31 to d24 d23 to d16 d15 to d8 d7 to d0 we3 we3 we3 we3 , dqmuu dqmuu dqmuu dqmuu we2 we2 we2 we2 , dqmul dqmul dqmul dqmul we1 we1 we1 we1 , dqmlu dqmlu dqmlu dqmlu we0 we0 we0 we0 , dqmll dqmll dqmll dqmll byte access at 0 ? ? data 7to0 ? assert byte access at 1 ? ? ? data 7to0 assert byte access at 2 ? ? data 7to0 ? assert byte access at 3 ? ? ? data 7to0 assert word access at 0 ? ? data 15 to 8 data 7to0 assert assert word access at 2 ? ? data 15 to 8 data 7to0 assert assert 1st time at 0 ??data 31 to 24 data 23 to 16 assert assert longword access at 0 2nd time at 2 ??data 15 to 8 data 7to0 assert assert
rev. 4.00, 03/04, page 194 of 660 table 8.13 8-bit external device/big endian access and data alignment data bus strobe signals operation d31 to d24 d23 to d16 d15 to d8 d7 to d0 we3 we3 we3 we3 , dqmuu dqmuu dqmuu dqmuu we2 we2 we2 we2 , dqmul dqmul dqmul dqmul we1 we1 we1 we1 , dqmlu dqmlu dqmlu dqmlu we0 we0 we0 we0 , dqmll dqmll dqmll dqmll byte access at 0 ? ? ? data 7to0 assert byte access at 1 ? ? ? data 7to0 assert byte access at 2 ? ? ? data 7to0 assert byte access at 3 ? ? ? data 7 to 0 assert 1st time at 0 ?? ?data 15 to 8 assert word access at 0 2nd time at 1 ?? ?data 7to0 assert 1st time at 2 ?? ?data 15 to 8 assert word access at 2 2nd time at 3 ?? ?data 7to0 assert 1st time at 0 ?? ?data 31 to 24 assert 2nd time at 1 ?? ?data 23 to 16 assert 3rd time at 2 ?? ?data 15 to 8 assert longword access at 0 4th time at 3 ?? ?data 7to0 assert
rev. 4.00, 03/04, page 195 of 660 table 8.14 32-bit external device/little endian access and data alignment data bus strobe signals operation d31 to d24 d23 to d16 d15 to d8 d7 to d0 we3 we3 we3 we3 , dqmuu dqmuu dqmuu dqmuu we2 we2 we2 we2 , dqmul dqmul dqmul dqmul we1 we1 we1 we1 , dqmlu dqmlu dqmlu dqmlu we0 we0 we0 we0 , dqmll dqmll dqmll dqmll byte access at 0 ? ? ? data 7to0 assert byte access at 1 ? ? data 7to0 ? assert byte access at 2 ? data 7to0 ? ? assert byte access at 3 data 7to0 ???assert word access at 0 ? ? data 15 to 8 data 7to0 assert assert word access at 2 data 15 to 8 data 7to0 ? ? assert assert longword access at 0 data 31 to 24 data 23 to 16 data 15 to 8 data 7to0 assert assert assert assert table 8.15 16-bit external device/little endian access and data alignment data bus strobe signals operation d31 to d24 d23 to d16 d15 to d8 d7 to d0 we3 we3 we3 we3 , dqmuu dqmuu dqmuu dqmuu we2 we2 we2 we2 , dqmul dqmul dqmul dqmul we1 we1 we1 we1 , dqmlu dqmlu dqmlu dqmlu we0 we0 we0 we0 , dqmll dqmll dqmll dqmll byte access at 0 ? ? ? data 7to0 assert byte access at 1 ? ? data 7to0 ? assert byte access at 2 ? ? ? data 7to0 assert byte access at 3 ? ? data 7to0 ? assert word access at 0 ? ? data 15 to 8 data 7to0 assert assert word access at 2 ? ? data 15 to 8 data 7to0 assert assert 1st time at 0 ??data 15 to 8 data 7to0 assert assert longword access at 0 2nd time at 2 ??data 31 to 24 data 23 to 16 assert assert
rev. 4.00, 03/04, page 196 of 660 table 8.16 8-bit external device/little endian access and data alignment data bus strobe signals operation d31 to d24 d23 to d16 d15 to d8 d7 to d0 we3 we3 we3 we3 , dqmuu dqmuu dqmuu dqmuu we2 we2 we2 we2 , dqmul dqmul dqmul dqmul we1 we1 we1 we1 , dqmlu dqmlu dqmlu dqmlu we0 we0 we0 we0 , dqmll dqmll dqmll dqmll byte access at 0 ? ? ? data 7to0 assert byte access at 1 ? ? ? data 7to0 assert byte access at 2 ? ? ? data 7to0 assert byte access at 3 ? ? ? data 7to0 assert 1st time at 0 ? ??data 7to0 assert word access at 0 2nd time at 1 ? ??data 15 to 8 assert 1st time at 2 ? ??data 7to0 assert word access at 2 2nd time at 3 ? ??data 15 to 8 assert 1st time at 0 ? ??data 7to0 assert 2nd time at 1 ? ??data 15 to 8 assert 3rd time at 2 ? ??data 23 to 16 assert longword access at 0 4th time at 3 ? ??data 31 to 24 assert
rev. 4.00, 03/04, page 197 of 660 8.5.2 description of areas area 0: area 0 physical addresses a28 to a26 are 000. addresses a31 to a29 are ignored and the address range is h'00000000 + h'20000000 n ? h'03ffffff + h'20000000 n(n = 0to6and n = 1 to 6 are the shadow spaces). ordinary memories such as sram, rom, and burst rom can be connected to this space. byte, word, or longword can be selected as the bus width using external pins md3 and md4. when the area 0 space is accessed, a cs0 signal is asserted. an rd signal that can be used as oe and the we0 to we3 signals for write control are also asserted. the number of bus cycles is selected between 0 and 10 wait cycles using the a0w2 to a0w0 bits of wcr2. in addition, any number of waits can be inserted in each bus cycle by means of the external wait pin ( wait ). when the burst function is used, the bus cycle pitch of the burst cycle is determined within a range of 2 to 10 according to the number of waits. area 1: area 1 physical addresses a28 to a26 are 001. addresses a31 to a29 are ignored and the address range is h'04000000 + h'20000000 n to h'07ffffff + h'20000000 n(n = 0to6 and n = 1 to 6 are the shadow spaces). area 1 is the area specifically for the internal peripheral modules. the external memories cannot be connected. control registers of peripheral modules shown below are mapped to this area 1. their addresses are physical address, to which logical addresses can be mapped with the mmu enabled: dmac, port, scif, adc, dac, intc (except intevt, ipra, iprb) those registers must be set not to be cached. area 2: area 2 physical addresses a28 to a26 are 010. addresses a31 to a29 are ignored and the address range is h'08000000 + h'20000000 n to h'0bffffff + h'20000000 n(n = 0to6 and n = 1 to 6 are the shadow spaces). ordinary memories like sram and rom, as well as synchronous dram, can be connected to this space. byte, word, or longword can be selected as the bus width using the a2sz1 to a2sz0 bits of bcr2 for ordinary memory. when the area 2 space is accessed, a cs2 signal is asserted. when ordinary memories are connected, an rd signal that can be used as oe and the we0 to we3 signals for write control are also asserted and the number of bus cycles is selected between 0 and 3 wait cycles using the a2w1 to a2w0 bits of wcr2. when synchronous dram is connected, the rasu , rasl signal, casu , casl signal, rd/ wr signal, and byte controls dqmhh , dqmhl , dqmlh ,and dqmll are all asserted and addresses multiplexed. control of rasu , rasl , casu , casl , data timing, and address multiplexing is set with mcr.
rev. 4.00, 03/04, page 198 of 660 area 3: area 3 physical addresses a28 to a26 are 011. addresses a31 to a29 are ignored and the address range is h'0c000000 + h'20000000 n to h'0fffffff + h'20000000 n(n = 0to6 and n = 1 to 6 are the shadow spaces). ordinary memories like sram and rom, as well as synchronous dram, can be connected to this space. byte, word or longword can be selected as the bus width using the a3sz1 to a3sz0 bits of bcr2 for ordinary memory. when area 3 space is accessed, cs3 is asserted. when ordinary memories are connected, an rd signal that can be used as oe and the we0 to we3 signals for write control are asserted and the number of bus cycles is selected between 0 and 3waitcyclesusingthea3w1toa3w0bitsofwcr2. when synchronous dram is connected, the rasu , rasl signal, casu , casl signal, rd/ wr signal, and byte controls dqmhh , dqmhl , dqmlh ,and dqmll are all asserted and addresses multiplexed. control of ras , cas , and data timing and of address multiplexing is set with mcr. area 4: area 4 physical addresses a28 to a26 are 100. addresses a31 to a29 are ignored and the address range is h'10000000 + h'20000000 n to h'13ffffff + h'20000000 n(n = 0to6 and n = 1 to 6 are the shadow spaces). only ordinary memories like sram and rom can be connected to this space. byte, word, or longword can be selected as the bus width using the a4sz1 to a4sz0 bits of bcr2. when the area 4 space is accessed, a cs4 signal is asserted. an rd signal that can be used as oe and the we0 to we3 signals for write control are also asserted. the number of bus cycles is selected between0and10waitcyclesusingthea4w2toa4w0bitsofwcr2. area 5: area 5 physical addresses a28 to a26 are 101. addresses a31 to a29 are ignored and the address range is the 64 mbytes at h'14000000 + h'20000000 n to h'17ffffff + h'20000000 n(n = 0to6andn = 1 to 6 are the shadow spaces). ordinary memories like sram and rom as well as burst rom and pcmcia interfaces can be connected to this space. when the pcmcia interface is used, the ic memory card interface address range comprises the 32 mbytes at h'14000000 + h'20000000 n to h'15ffffff + h'20000000 n (where n = 0 to 6, and n = 1 to 6 represents shadow space), and the i/o card interface address range comprises the 32 mbytes at h'16000000 + h'20000000 nto h'17ffffff + h'20000000 x n (where n = 0 to 6, and n = 1 to 6 represents shadow space). for ordinary memory and burst rom, byte, word, or longword can be selected as the bus width using the a5sz1 to a5sz0 bits of bcr2. for the pcmcia interface, byte, and word can be selected as the bus width using the a5sz1 to a5sz0 bits of bcr2.
rev. 4.00, 03/04, page 199 of 660 when the area 5 space is accessed and ordinary memory is connected, a cs5 signal is asserted. an rd signal that can be used as oe and the we0 to we3 signals for write control are also asserted. when the pcmcia interface is used, the ce1a signal, ce2a signal, rd signal as oe signal, and we1 , iciord ,and iciowr signals are asserted. the number of bus cycles is selected between 0 and 10 wait cycles using the a5w2 to a5w0 bits of wcr2. with the pcmcia interface, from 0 to 38 wait cycles can be selected using the a5w2 to a5w0 bits of wcr2 and the a5w3 bit of pcr. in addition, any number of waits can be inserted in each bus cycle by means of the external wait pin ( wait ). when a burst function is used, the bus cycle pitch of the burst cycle is determined within a range of 2 to 11 (2 to 39 for the pcmcia interface) according to the number of waits. the setup and hold times of address/ cs5 for the read/write strobe signals can be set in the range 0.5 to 7.5 using a5ted2 to a5ted0 and a5teh2 to a5teh0 bits of the pcr register. area 6: area 6 physical addresses a28 to a26 are 110. addresses a31 to a29 are ignored and the address range is the 64 mbytes at h'18000000 + h'20000000 n ? h'1bffffff + h'20000000 n(n = 0to6andn = 1 to 6 are the shadow spaces). ordinary memories like sram and rom as well as burst rom and pcmcia interfaces can be connected to this space. when the pcmcia interface is used, the ic memory card interface address range is 32 mbytes at h'18000000 + h'20000000 n ? h'19ffffff + h'20000000 n and the i/o card interface address range is 32 mbytes at h'1a000000 + h'20000000 n? h'1bffffff + h'20000000 n(n = 0to6andn = 1 to 6 are the shadow spaces). for ordinary memory and burst rom, byte, word, or longword can be selected as the bus width using the a6sz1 to a6sz0 bits of bcr2. for the pcmcia interface, byte, and word can be selected as the bus width using the a6sz1 to a6sz0 bits of bcr2. when the area 6 space is accessed and ordinary memory is connected, a cs6 signal is asserted. an rd signal that can be used as oe and the we0 to we3 signals for write control are also asserted. when the pcmcia interface is used, the ce1b signal, ce2b signal, rd signal as oe signal, and we , iciord ,and iciowr signals are asserted. the number of bus cycles is selected between 0 and 10 wait cycles using the a6w2 to a6w0 bits of wcr2. with the pcmcia interface, from 0 to 38 wait cycles can be selected using the a6w2 to a6w0 bits of wcr2 and the a6w3 bit of pcr. in addition, any number of waits can be inserted in each bus cycle by means of the external wait pin ( wait ).thebuscyclepitchofthe burst cycle is determined within a range of 2 to 11 (2 to 39 for the pcmcia interface) according to the number of waits. the setup and hold times of address/ cs6 for the read/write strobe signals can be set in the range 0.5 to 7.5 using a6ted2 to a6ted0 and a6teh2 to a6teh0 bits of the pcr register.
rev. 4.00, 03/04, page 200 of 660 8.5.3 basic interface basic timing: the basic interface of this lsi uses strobe signal output in consideration of the fact that mainly static ram will be directly connected. figure 8.5 shows the basic timing of normal space accesses. a no-wait normal access is completed in two cycles. the bs signal is asserted for one cycle to indicate the start of a bus cycle. the csn signal is negated on the t2 clock falling edge to secure the negation period. therefore, in case of access at minimum pitch, there is a half- cycle negation period. there is no access size specification when reading. the correct access start address is output in the least significant bit of the address, but since there is no access size specification, 32 bits are always read in case of a 32-bit device, and 16 bits in case of a 16-bit device. when writing, only the we signal for the byte to be written is asserted. for details, see section 8.5.1, endian/access size and data alignment. read/write for cache fill or write-back follows the set bus width and transfers a total of 16 bytes continuously. the bus is not released during this transfer. for cache misses that occur during byte or word operand accesses or branching to odd word boundaries, the fill is always performed by longword accesses on the chip-external interface. write-through-area write access and non- cacheable read/write access are based on the actual address size. t1 ckio a25 to a0 csn rd/wr rd d31 to d0 wen d31 to d0 bs t2 read write figure 8.5 basic timing of basic interface
rev. 4.00, 03/04, page 201 of 660 figures 8.6, 8.7, and 8.8 show examples of connection to 32, 16, and 8-bit data-width static ram, respectively. ?     a16 a0 cs oe i/o7 i/o0 we     a18 a2 csn rd d31 d24 we3 d23 d16 we2 d15 d8 we1 d7 d0 we0 this lsi 128k 8-bit sram  a16 a0 cs oe i/o7 i/o0 we      a16 a0 cs oe i/o7 i/o0 we     a16 a0 cs oe i/o7 i/o0 we      figure 8.6 example of 32-bit data-width static ram connection
rev. 4.00, 03/04, page 202 of 660 a16 a0 cs oe i/o7 i/o0 we     a17 a1 csn rd d15 d8 we1 d7 d0 we0 this lsi 128k  a16 a0 cs oe i/o7 i/o0 we         figure 8.7 example of 16-bit data-width static ram connection a16 a0 csn rd d7 d0 we0 this lsi 128k  a16 a0 cs oe i/o7 i/o0 we        figure 8.8 example of 8-bit data-width static ram connection
rev. 4.00, 03/04, page 203 of 660 wait state control: wait state insertion on the basic interface can be controlled by the wcr2 settings. if the wcr2 wait specification bits corresponding to a particular area are not zero, a software wait is inserted in accordance with that specification. for details, see section 8.4.4, wait state control register 2 (wcr2) the specified number of tw cycles are inserted as wait cycles using the basic interface wait timing showninfigure8.9. t1 ckio a25 to a0 csn rd/wr rd d31 to d0 wen d31 to d0 bs tw t2 read write figure 8.9 basic interface wait timing (software wait only) when software wait insertion is specified by wcr2, the external wait input wait signal is also sampled. wait pin sampling is shown in figure 8.10. a 2-cycle wait is specified as a software wait. sampling is performed at the transition from the tw state to the t2 state; therefore, if the wait signal has no effect if asserted in the t1 cycle or the first tw cycle. when the waitsel bit in the wcr1 register is set to 1, the wait signal is sampled at the falling edge of the clock. if the setup time and hold times with respect to the falling edge of the clock are not satisfied, the value sampled at the next falling edge is used.
rev. 4.00, 03/04, page 204 of 660 however, the wait signal is ignored in the following cases: ? in 16-byte dma transfer or dual addressing mode, or when writing data to the external address area ? in 16-byte dma transfer or single addressing mode, or when transferring data from an external device with dack to the external address area ? when accessing cache for write back t1 ckio a25 to a0 csn rd/wr rd d31 to d0 wen d31 to d0 wait tw tw tw t2 read write bs wait states inserted by wait signal figure 8.10 basic interface wait state timing (wait state insertion by wait wait wait wait signal waitsel = 1)
rev. 4.00, 03/04, page 205 of 660 8.5.4 synchronous dram interface ? synchronous dram direct connection since synchronous dram can be selected by the cs signal, physical space areas 2 and 3 can be connected using ras and other control signals in common. if the memory type bits (dramtp2 to 0) in bcr1 are set to 010, area 2 is ordinary memory space and area 3 is synchronous dram space; if set to 011, areas 2 and 3 are both synchronous dram space. however, do not access to the synchronous dram when clock ratio is i?:b? = 1:1. with this lsi, burst length 1 burst read/single write mode is supported as the synchronous dram operating mode. a data bus width of 16 or 32 bits can be selected. a 16-byte burst transfer is performed in a cache fill/write-back cycle, and only one access is performed in a write-through area write or a non-cacheable area read/write. the control signals for direct connection of synchronous dram are rasl , rasu , casl , casu ,rd/ wr , cs2 or cs3 , dqmuu , dqmul , dqmlu , dqmll , and cke. all the signals other than cs2 and cs3 are common to all areas, and signals other than cke are valid and fetched to the synchronous dram only when cs2 or cs3 is asserted. synchronous dram can therefore be connected in parallel to a number of areas. cke is negated (low) only when self-refreshing is performed, and is always asserted (high) at other times. in the refresh cycle and mode-register write cycle, rasu and rasl or casu and casl are output. commands for synchronous dram are specified by rasl , rasu , casl , casu ,rd/ wr ,and special address signals. the commands are nop, auto-refresh (ref), self-refresh (self), precharge all banks (pall), row address strobe bank active (actv), read (read), read with precharge (reada), write (writ), write with precharge (writa), and mode register write (mrs). byte specification is performed by dqmuu , dqmul , dqmlu ,and dqmll . a read/write is performed for the byte for which the corresponding dqm is low. in big-endian mode, dqmuu specifies an access to address 4n, and dqmll specifies an access to address 4n + 3. in little- endian mode, dqmuu specifies an access to address 4n + 3, and dqmll specifies an access to address 4n. figures 8.11 shows examples of the connection of two 1m 16-bit 4-bank synchronous drams and figure 8.12 shows one 1m 16-bit 4-bank synchronous dram, respectively.
rev. 4.00, 03/04, page 206 of 660 a15 a14 a13 a2 ckio cke rd/ d31 d16 d15 d0 this lsi 64m synchronous dram (1m             note : "x" is u or l figure 8.11 example of 64-mbit synchronous dram connection (32-bit bus width)
rev. 4.00, 03/04, page 207 of 660 this lsi 64m synchronous dram 1m         figure 8.12 example of 64-mbit synchronous dram (16-bit bus width) ? address multiplexing synchronous dram can be connected without external multiplexing circuitry in accordance with the address multiplex specification bits amx3-amx0 in mcr. table 8.17 shows the relationship between the address multiplex specification bits and the bits output at the address pins. a25 to a17 and a0 are not multiplexed; the original values are always output at these pins. when a0, the lsb of the synchronous dram address, is connected to this lsi, it performs longword address specification. connection should therefore be made in the following order: connect pin a0 of the synchronous dram to pin a2 of this lsi, then connect pin a1 to pin a3. table 8.18 shows an example of the connection of address pins when amx[3:0] = 0100 with 32- bit bus width.
rev. 4.00, 03/04, page 208 of 660 table 8.17 relationship between bus width, amx, and address multiplex output setting external address pins bus width memory type amx3 amx2 amx1 amx0 output timing a1 to a8 a9 a10 a11 a12 a13 a14 a15 a16 column address a1 to a8 a9 a10 a11 l/h * 3 a13 a23 a24 * 4 a25 * 4 4m 16 bits 4 banks * 1 11 0 1 row address a10 to a17 a18 a19 a20 a21 a22 a23 a24 a25 * 4 column address a1 to a8 a9 a10 a11 l/h * 3 a13 a23 * 4 a24 * 4 2m 16 bits 4 banks * 2 01 0 1 row address a10 to a17 a18 a19 a20 a21 a22 a23 * 4 a24 * 4 column address a1 to a8 a9 a10 a11 l/h * 3 a13 a22 * 4 a23 * 4 1m 16 bits 4 banks * 2 01 0 0 row address a9 to a16 a17 a18 a19 a20 a21 a22 * 4 a23 * 4 column address a1 to a8 a9 a10 a11 l/h * 3 a13 a23 * 4 a24 * 4 2m 8bits 4 banks * 2 01 0 1 row address a10 to a17 a18 a19 a20 a21 a22 a23 * 4 a24 * 4 column address a1 to a8 a9 a10 a11 l/h * 3 a21 * 4 a22 * 4 a15 32 bits 512k 32 bits 4 banks * 2 01 1 1 row address a9 to a16 a17 a18 a19 a20 a21 * 4 a22 * 4 a23 column address a1 to a8 a9 a10 l/h * 3 a12 a23 a24 * 4 a25 * 4 8m 16 bits 4 banks * 1 11 1 0 row address a11 to a18 a19 a20 a21 a22 a23 a24 * 4 a25 * 4 column address a1 to a8 a9 a10 l/h * 3 a12 a22 a23 * 4 a24 * 4 4m 16 bits 4 banks * 2 11 0 1 row address a10 to a17 a18 a19 a20 a21 a22 a23 * 4 a24 * 4 column address a1 to a8 a9 a10 l/h * 3 a12 a22 * 4 a23 * 4 a24 2m 16 bits 4 banks * 2 01 0 1 row address a10 to a17 a18 a19 a20 a21 a22 * 4 a23 * 4 a24 column address a1 to a8 a9 a10 l/h * 3 a12 a21 * 4 a22 * 4 a15 1m 16 bits 4 banks * 2 01 0 0 row address a9 to a16 a17 a18 a19 a20 a21 * 4 a22 * 4 a23 column address a1 to a8 a9 a10 l/h * 3 a12 a22 * 4 a23 * 4 a24 16 bits 2m 8bits 4 banks * 2 01 0 1 row address a10 to a17 a18 a19 a20 a21 a22 * 4 a23 * 4 a24 notes: 1. only rasl / casl are output. 2. rasu and casu are output for upper 32-mbyte addresses, and rasl and casl for lower 32-mbyte addresses. 3. l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. 4. bank address specification
rev. 4.00, 03/04, page 209 of 660 table 8.18 example of correspondence between this lsi and synchronous dram address pins (amx (3 to 0) = 0100 (32-bit bus width)) address pin of this lsi synchronous dram address pin ras cycle cas cycle function a15 a23 a23 a13(ba1) bank select address a14 a22 a22 a12(ba0) a13 a21 a13 a11 address a12 a20 l/h a10 address/precharge setting a11 a19 a11 a9 a10 a18 a10 a8 a9 a17 a9 a7 a8 a16 a8 a6 a7 a15 a7 a5 a6 a14 a6 a4 a5 a13 a5 a3 a4 a12 a4 a2 a3 a11 a3 a1 a2 a10 a2 a0 address a1 a9 a1 not used a0 a8 a0 not used ? burst read figure 8.13 shows the timing chart for a burst read. in the example below, it is assumed that four 2m 8-bit synchronous drams are connected and a 32-bit data width is used, and the burst length is 1. following the tr cycle in which actv command output is performed, a read command is issued in the tc1, tc2, and tc3 cycles, and a reada command in the tc4 cycle, and the read data is accepted on the rising edge of the external command clock (ckio) from cycle td1 to cycle td4. the tpc cycle is used to wait for completion of auto-precharge based on the reada command inside the synchronous dram; no new access command can be issued to the same bank during this cycle, but access to synchronous dram for another area is possible. in the this lsi, the number of tpc cycles is determined by the tpc bit specification in mcr, and commands cannot be issued for the same synchronous dram during this interval.
rev. 4.00, 03/04, page 210 of 660 the example in figure 8.13 shows the basic timing. to connect low-speed synchronous dram, the cycle can be extended by setting wcr2 and mcr bits. the number of cycles from the actv command output cycle, tr, to the read command output cycle, tc1, can be specified by the rcdbitinmcr,withavaluesof0to3specifying1to4cycles,respectively.incaseof2or more cycles, a trw cycle, in which an nop command is issued for the synchronous dram, is inserted between the tr cycle and the tc cycle. the number of cycles from read and reada command output cycles tc1-tc4 to the first read data latch cycle, td1, can be specified as 1 to 3 cycles independently for areas 2 and 3 by means of a2w1 and a2w0 or a3w1 and a3w0 in wcr2. this number of cycles corresponds to the number of synchronous dram cas latency cycles. ckio address upper bits a12 or a11 address lower bits notes: 1. 2. * 1 * 2 command bit column address or rd/ d31 to d0 tr tc1 tc2/td1 tc3/td2 tc4/td3 td4 tpc figure 8.13 basic timing for synchronous dram burst read
rev. 4.00, 03/04, page 211 of 660 figure 8.14 shows the burst read timing when rcd is set to 1, a3w1 and a3w0 are set to 10, and tpc is set to 1. the bs cycle, which is asserted for one cycle at the start of a bus cycle for normal space access, is asserted in each of cycles td1 to td4 in a synchronous dram cycle. when a burst read is performed, the address is updated each time cas is asserted. as the unit of burst transfer is 16 bytes, address updating is performed for a3 and a2 only (a3, a2, and a1 for a 16-bit bus width). the order of access is as follows: in a fill operation in the event of a cache miss, the missed data is read first, then 16-byte boundary data including the missed data is read in wraparound mode. ckio or rd/ d31 to d0 tr tc1 tc2 tc3/td1 tc4/td2 td3 tpc trw td4 address upper bits a12 or a11 address lower bits notes: 1. 2. * 1 * 2 command bit column address figure 8.14 synchronous dram burst read wait specification timing
rev. 4.00, 03/04, page 212 of 660 ? single read figure 8.15 shows the timing when a single address read is performed. as the burst length is set to 1 in synchronous dram burst read/single write mode, only the required data is output. consequently, no unnecessary bus cycles are generated even when a cache-through area is accessed. ckio or rd/ d31 to d0 tr tc1 td1 tpc address upper bits a12 or a11 address lower bits notes: 1. 2. * 1 * 2 command bit column address figure 8.15 basic timing for synchronous dram single read
rev. 4.00, 03/04, page 213 of 660 ? burst write the timing chart for a burst write is shown in figure 8.16. in this lsi, a burst write occurs only in the event of cache write-back or 16-byte transfer by dmac. in a burst write operation, following the tr cycle in which actv command output is performed, a writ command is issued in the tc1, tc2, and tc3 cycles, and a writa command that performs auto-precharge is issued in the tc4 cycle. in the write cycle, the write data is output at the same time as the write command. in case of the write with auto-precharge command, precharging of the relevant bank is performed in the synchronous dram after completion of the write command, and therefore no command can be issued for the same bank until precharging is completed. consequently, in addition to the precharge wait cycle, tpc, used in a read access, cycle trwl is also added as a wait interval until precharging is started following the write command. issuance of a new command for the same bank is postponed during this interval. the number of trwl cycles can be specified by the trwl bit in mcr. ckio rd/ d31 to d0 (read) tr tc1 tc2 tc3 tc4 (trw1) (tpc) address upper bits address lower bits a12 or a11 notes: 1. 2. * 1 * 2 command bit column address figure 8.16 basic timing for synchronous dram burst write
rev. 4.00, 03/04, page 214 of 660 ? single write the basic timing chart for write access is shown in figure 8.17. in a single write operation, following the tr cycle in which actv command output is performed, a writa command that performs auto-precharge is issued in the tc1 cycle. in the write cycle, the write data is output at the same time as the write command. in case of the write with auto-precharge command, precharging of the relevant bank is performed in the synchronous dram after completion of the write command, and therefore no command can be issued for the same bank until precharging is completed. consequently, in addition to the precharge wait cycle, tpc, used in a read access, cycle trwl is also added as a wait interval until precharging is started following the write command. issuance of a new command for the same bank is postponed during this interval. the number of trwl cycles can be specified by the trwl bit in mcr. ckio rd/ d31 to d0 address upper bits address lower bits cke tr tc1 (trwl) (tpc) a12 or a11 notes: 1. 2. * 1 * 2 command bit column address figure 8.17 basic timing for synchronous dram single write
rev. 4.00, 03/04, page 215 of 660 ? bank active the synchronous dram bank function is used to support high-speed accesses to the same row address. when the rasd bit in mcr is 1, read/write command accesses are performed using commands without auto-precharge (read, writ). in this case, precharging is not performed when the access ends. when accessing the same row address in the same bank, it is possible to issue the read or writ command immediately, without issuing an actv command. as synchronous dram is internally divided into two or four banks, it is possible to activate one row address in each bank. if the next access is to a different row address, a pre command is first issued to precharge the relevant bank, then when precharging is completed, the access is performed by issuing an actv command followed by a read or writ command. if this is followed by an access to a different row address, the access time will be longer because of the precharging performed after the access request is issued. in a write, when auto-precharge is performed, a command cannot be issued for a period of trwl + tpc cycles after issuance of the writa command. when bank active mode is used, read or writ commands can be issued successively if the row address is the same. the number of cycles can thus be reduced by trwl + tpc cycles for each write. the number of cycles between issuance of the precharge command and the row address strobe command is determined by the tpc bit in mcr. whether faster execution speed is achieved by use of bank active mode or by use of basic access is determined by the probability of accessing the same row address (p1), and the average number of cycles from completion of one access to the next access (ta). if ta is greater than tpc, the delay due to the precharge wait when reading is imperceptible. if ta is greater than trw1 + tpc, the delay due to the precharge wait when writing is imperceptible. in this case, the access speed for bank active mode and basic access is determined by the number of cycles from the start of access to issuance of the read/write command: (tpc + trcd) (1 ? p1) and trcd, respectively. there is a limit on tras, the time for placing each bank in the active state. if there is no guarantee that there will not be a cache hit and another row address will be accessed within the period in which this value is maintained by program execution, it is necessary to set auto-refresh and set the refresh cycle to no more than the maximum value of tras. in this way, it is possible to observe the restrictions on the maximum active state time for each bank. if auto-refresh is not used, measures must be taken in the program to ensure that the banks do not remain active for longer than the prescribed time. a burst read cycle without auto-precharge is shown in figure 8.18, a burst read cycle for the same row address in figure 8.19, and a burst read cycle for different row addresses in figure 8.20. similarly, a burst write cycle without auto-precharge is shown in figure 8.21, a burst write cycle for the same row address in figure 8.22, and a burst write cycle for different row addresses in figure 8.23.
rev. 4.00, 03/04, page 216 of 660 a tnop cycle, in which no operation is performed, is inserted before the tc1 cycle in which the read command is issued in figure 8.19, but when synchronous dram is read, there is a two- cycle latency for the dqmxx signal that performs the byte specification. if the tc1 cycle were performed immediately, without inserting a tnop cycle, it would not be possible to perform the dqmxx signal specification for td1 cycle data output. this is the reason for inserting the tnop cycle. if the cas latency is two cycles or longer, tnop cycle insertion is not performed, since the timing requirements will be met even if the dqmxx signal is set after the tc1 cycle. when bank active mode is set, if only accesses to the respective banks in the area 3 space are considered, as long as accesses to the same row address continue, the operation starts with the cycle in figure 8.18 or 8.21, followed by repetition of the cycle in figure 8.19 or 8.22. an access to a different area 3 space during this time has no effect. if there is an access to a different row address in the bank active state, after this is detected the bus cycle in figure 8.19 or 8.22 is executed instead of that in figure 8.19 or 8.22. in bank active mode, too, all banks become inactive after a refresh cycle or after the bus is released as the result of bus arbitration. ckio or rd/ d31 to d0 tr tc1 tc2/td1 tc3/td2 tc4/td3 td4 address upper bits a12 or a11 address lower bits notes: 1. 2. * 1 * 2 command bit column address figure 8.18 burst read timing (no precharge)
rev. 4.00, 03/04, page 217 of 660 ckio or rd/ d31 to d0 tnop tc1 tc2/td1 tc3/td2 tc4/td3 td4 address upper bits a12 or a11 address lower bits notes: 1. 2. * 1 * 2 command bit column address figure 8.19 burst read timing (same row address)
rev. 4.00, 03/04, page 218 of 660 ckio or rd/ d31 to d0 tp tr tc1 tc2/td1 tc3/td2 tc4/td3 td4 address upper bits a12 or a11 address lower bits notes: 1. 2. * 1 * 2 command bit column address figure 8.20 burst read timing (different row addresses)
rev. 4.00, 03/04, page 219 of 660 ckio or rd/ d31 to d0 tr tc1 tc2 tc3 tc4 address upper bits a12 or a11 address lower bits notes: 1. 2. * 1 * 2 command bit column address figure 8.21 burst write timing (no precharge)
rev. 4.00, 03/04, page 220 of 660 ckio or rd/ d31 to d0 tc1 tc2 tc3 tc4 address upper bits a12 or a11 address lower bits notes: 1. 2. * 1 * 2 command bit column address figure 8.22 burst write timing (same row address)
rev. 4.00, 03/04, page 221 of 660 ckio or rd/ d31 to d0 tp tr tc1 tc2 tc3 td4 address upper bits a12 or a11 address lower bits notes: 1. 2. * 1 * 2 command bit column address figure 8.23 burst write timing (different row addresses) ? refreshing the bus state controller is provided with a function for controlling synchronous dram refreshing. auto-refreshing can be performed by clearing the rmode bit to 0 and setting the rfsh bit to 1 in mcr. if synchronous dram is not accessed for a long period, self-refresh mode, in which the power consumption for data retention is low, can be activated by setting both the rmode bit and the rfsh bit to 1.
rev. 4.00, 03/04, page 222 of 660 1. auto-refreshing figure 8.24 shows the auto-refreshing operation. refreshing is performed at intervals determined by the input clock selected by bits cks2 to 0 in rtcsr, and the value set in rtcor. the value of bits cks2 to 0 in rtcor should be set so as to satisfy the refresh interval stipulation for the synchronous dram used. first make the settings for rtcor, rtcnt, and the rmode and rfsh bits in mcr, then make the cks2 to cks0 setting. when the clock is selected by cks2 to cks0, rtcnt starts counting up from the value at that time. the rtcnt value is constantly compared with the rtcor value, and if the two values are the same, a refresh request is generated and an auto-refresh is performed. at the same time, rtcnt is cleared to zero and the count-up is restarted. figure 8.25 shows the auto-refresh cycle timing. all-bank precharging is performed in the tp cycle, then an ref command is issued in the trr cycle following the interval specified by the tpc bits in mcr. after the trr cycle, new command output cannot be performed for the duration of the number of cycles specified by the tras bits in mcr plus the number of cycles specified by the tpc bits in mcr. the tras and tpc bits must be set so as to satisfy the synchronous dram refresh cycle time stipulation (active/active command delay time). auto-refreshing is performed in normal operation, in sleep mode, and in case of a manual reset. rtcor value rtcnt h'00000000 rtcsr.cks(2 to 0) cmf external bus cmf flag cleared by start of refresh cycle = 000 figure 8.24 auto-refresh operation
rev. 4.00, 03/04, page 223 of 660 tp trr trrw trrw (tpc) ckio cke , , rd/ figure 8.25 synchronous dram auto-refresh timing 2. self-refreshing self-refresh mode is a kind of standby mode in which the refresh timing and refresh addresses are generated within the synchronous dram. self-refreshing is activated by setting both the rmode bit and the rfsh bit to 1. the self-refresh state is maintained while the cke signal is low. synchronous dram cannot be accessed while in the self-refresh state. self-refresh mode is cleared by clearing the rmode bit to 0. after self-refresh mode has been cleared, command issuance is disabled for the number of cycles specified by the tpc bits in mcr. self-refresh timing is shown in figure 8.26. settings must be made so that self-refresh clearing and data retention are performed correctly, and auto-refreshing is performed at the correct intervals. when self-refreshing is activated from the state in which auto-refreshing is set, or when exiting standby mode other than through a power-on reset, auto-refreshing is restarted if rfsh is set to 1 and rmode is cleared to 0 when self-refresh mode is cleared. if the transition from clearing of self-refresh mode to the start of auto-refreshing takes time, this time should be taken into consideration when setting the initial value of rtcnt. making the rtcnt value 1 less than the rtcor value will enable refreshing to be started immediately. after self-refreshing has been set, the self-refresh state continues even if the chip standby state is entered using the this lsi standby function, and is maintained even after recovery from standby mode other than through a power-on reset. in case of a power-on reset, the bus state controller's registers are initialized, and therefore the self-refresh state is cleared. self-refreshing is performed in normal operation, in sleep mode, in standby mode, and in case of a manual reset.
rev. 4.00, 03/04, page 224 of 660 when using synchronous dram, use the following procedure to initiate self-refreshing. 1. clear the refresh control bit to 0. 2. write h'00 to the rtcnt register. 3. set the refresh control bit and refresh mode bit to 1. trs1 ckio rd/ , , cke (trs2) (trs2) trs3 (tpc) (tpc) tp figure 8.26 synchronous dram self-refresh timing 3. relationship between refresh requests and bus cycle requests if a refresh request is generated during execution of a bus cycle, execution of the refresh is deferred until the bus cycle is completed. if a refresh request occurs when the bus has been released by the bus arbiter, refresh execution is deferred until the bus is acquired. if a match between rtcnt and rtcor occurs while a refresh is waiting to be executed, so that a new refresh request is generated, the previous refresh request is eliminated. in order for refreshing to be performed normally, care must be taken to ensure that no bus cycle or bus mastership occurs that is longer than the refresh interval. when a refresh request is generated, the irqout pin is asserted (driven low). therefore, normal refreshing can be performed by having the irqout pin monitored by a bus master other than this lsi requesting the bus, or the bus arbiter, and returning the bus to this lsi. when refreshing is started, and if no other interrupt request has been generated, the irqout pin is negated (driven high).
rev. 4.00, 03/04, page 225 of 660 ? power-on sequence in order to use synchronous dram, mode setting must first be performed after powering on. to perform synchronous dram initialization correctly, the bus state controller registers must first be set, followed by a write to the synchronous dram mode register. in synchronous dram mode register setting, the address signal value at that time is latched by a combination of the ras , cas , and rd/ wr signals. if the value to be set is x, the bus state controller provides for value x to be written to the synchronous dram mode register by performing a write to address h'ffffd000 + x for area 2 synchronous dram, and to address h'ffffe000 + x for area 3 synchronous dram. in this operation the data is ignored, but the mode write is performed as a byte-size access. to set burst read/single write, cas latency 1 to 3, wrap type = sequential, and burst length 1 supported by this lsi, arbitrary data is written in a byte-size access to the following addresses. area 2 area 3 32-bit cas latency 1 ffffd840 ffffe840 bus width cas latency 2 ffffd880 ffffe880 cas latency 3 ffffd8c0 ffffe8c0 area 2 area 3 16-bit cas latency 1 ffffd420 ffffe420 bus width cas latency 2 ffffd440 ffffe440 cas latency 3 ffffd460 ffffe460 mode register setting timing is shown in figure 8.27. as a result of the write to address h'ffffd000 + x or h'ffffe000 + x, a precharge all banks (pall) command is first issued in the trp1 cycle, then a mode register write command is issued in the tmw1 cycle. address signals, when the mode-register write command is issued, are as follows: 32-bit a15 to a9 0000100 (burst read and single write) bus width a8 to a6 cas latency a5 0 (burst type = sequential) a4 to a2 000 (burst length 1) 16-bit a14 to a8 0000100 (burst read and single write) bus width a7 to a5 cas latency a4 0 (burst type = sequential) a3 to a1 000 (burst length 1)
rev. 4.00, 03/04, page 226 of 660 before mode register setting, a 100 s idle time (depending on the memory manufacturer) must be guaranteed after powering on requested by the synchronous dram. if the reset signal pulse width is greater than this idle time, there is no problem in performing mode register setting immediately. the number of dummy auto-refresh cycles specified by the manufacturer (usually 8) or more must be executed. this is usually achieved automatically while various kinds of initialization are being performed after auto-refresh setting, but a way of carrying this out more dependably is to set a short refresh request generation interval just while these dummy cycles are being executed. with simple read or write access, the address counter in the synchronous dram used for auto- refreshing is not initialized, and so the cycle must always be an auto-refresh cycle. ckio a11 (a10) a12 (a11) a10 to a2 (a9 to a2) rd/ or or d31 to d0 cke trp1 trp2 trp3 trp4 tmw1 tmw2 tmw3 tmw4 (high) a15 to a12 or (a14 to a11) figure 8.27 synchronous dram mode write timing
rev. 4.00, 03/04, page 227 of 660 8.5.5 burst rom interface setting bits a0bst (1 to 0), a5bst (1 to 0), and a6bst (1 to 0) in bcr1 to a non-zero value allows burst rom to be connected to areas 0, 5, and 6. the burst rom interface provides high- speed access to rom that has a nibble access function. the timing for nibble access to burst rom is shown in figure 8.28. two wait cycles are set. basically, access is performed in the same way as for normal space, but when the first cycle ends the cs0 signal is not negated, and only the address is changed before the next access is executed. when 8-bit rom is connected, the number of consecutive accesses can be set as 4, 8, or 16 by bits a0bst (1 to 0), a5bst (1 to 0), or a6bst (1 to 0). when 16-bit rom is connected, 4 or 8 can be set in the same way. when 32-bit rom is connected, only 4 can be set. wait pin sampling is performed in the first access if one or more wait states are set, and is always performed in the second and subsequent accesses. the second and subsequent access cycles also comprise two cycles when a burst rom setting is made and the wait specification is 0. the timing in this case is shown in figure 8.29. however, the wait signal is ignored in the following cases: ? in 16-byte dma transfer or dual addressing mode, or when writing data to the external address area ? in 16-byte dma transfer or single addressing mode, or when transferring data from an external device with dack to the external bus area ? when accessing cache for write back
rev. 4.00, 03/04, page 228 of 660 t1 tw tw tb2 tb1 tw tb2 ckio a25 to a4 a3 to a0 csn rd/ wr rd d31 to d0 bs wait t2 note: for a write cycle, a basic bus cycle (write cycle) is performed. tb1 figure 8.28 burst rom wait access timing
rev. 4.00, 03/04, page 229 of 660 t1 tb2 tb1 tb2 tb1 tb2 tb1 t2 ckio a25 to a4 a3 to a0 rd/ d31 to d0 note: for a write cycle, a basic bus cycle (write cycle) is performed. figure 8.29 burst rom basic access timing 8.5.6 pcmcia interface in this lsi, setting the a5pcm bit in bcr1 to 1 makes the bus interface for physical space area 5 an ic memory card and i/o card interface as stipulated in jeida version 4.2 (pcmcia2.1). setting the a6pcm bit to 1 makes the bus interface for physical space area 6 an ic memory card and i/o card interface as stipulated in jeida version 4.2. figure 8.30 shows the pcmcia space allocation. when the pcmcia interface is used, a bus size of 8 or 16 bits can be set by bits a5sz1 and a5sz0, or a6sz1 and a6sz0, in bcr2.
rev. 4.00, 03/04, page 230 of 660 figure 8.31 shows an example of pcmcia card connection to this lsi. to enable active insertion of the pcmcia cards (i.e. insertion or removal while system power is being supplied), a 3-state buffer must be connected between this lsi bus interface and the pcmcia cards. as operation in big-endian mode is not explicitly stipulated in the jeida/pcmcia specifications, the pcmcia interface for this lsi in big-endian mode is stipulated independently. however, the wait signal is ignored in the following cases: ? in 16-byte dma transfer or dual addressing mode, or when writing data to the external address area ? in 16-byte dma transfer or single addressing mode, or when transferring data from an external device with dack to the external bus area ? when accessing cache for write back i/o space i/o space i/o space area 5: h'14000000 area 5: h'16000000 area 6: h'18000000 area 6: h'1a000000 area 5: h'14000000 area 5: h'15000000 area 5: h'16000000 h'17000000 area 6: h'18000000 area 6: h'19000000 area 6: h'1a000000 h'1b000000 attribute memory common memory attribute memory common memory i/o space up to 16-mbyte capacity (reg = a24) 32-mbyte capacity (reg = i/o port) common memory/ attribute memory common memory/ attribute memory figure 8.30 pcmcia space allocation
rev. 4.00, 03/04, page 231 of 660 a24 to a0 d15 to d0 rd/ wr ce1b / (cs6) ce1a / (cs5) rd we iciord iciowr wait iois16 this lsi a25 to a0 d15 to d0 ce2 oe we / pgm (iord) (iowr) wait (iois16) cd1, cd2 ce1 pc card (memory/io) g g g dir dir g d7 to d0 d15 to d8 a25 to a0 d15 to d0 ce2 oe we / pgm wait cd1, cd2 ce1 pc card (memory/io) g g g dir dir g d7 to d0 d15 to d8 ce2b ce2a output port card detection circuit card detection circuit figure 8.31 example of pcmcia interface
rev. 4.00, 03/04, page 232 of 660 memory card interface basic timing: figure 8.32 shows the basic timing for the pcmcia ic memory card interface. when physical space areas 5 and 6 are designated as pcmcia interface areas, bus accesses are automatically performed as ic memory card interface accesses. with a high external bus frequency (ckio), the setup and hold times for the address (a24 to a0), card enable ( cs5 , ce2a , cs6 , ce2b ), and write data (d15 to d0) in a write cycle, become insufficient with respect to rd and wr (the we pin in this lsi). this lsi provides for this by enabling setup and hold times to be set for physical space areas 5 and 6 in the pcr register. also, software waits by means of a wcr2 register setting and hardware waits by means of the wait pin can be inserted in the same way as for the basic interface. figure 8.33 shows the pcmcia memory bus wait timing. ckio tpcm1 tpcm2 a25 to a0 rd/ d15 to d0 (read) d15 to d0 (write) (read) (write) figure 8.32 basic timing for pcmcia memory card interface
rev. 4.00, 03/04, page 233 of 660 ckio tpcm0 a25 to a0 rd/ (read) d15 to d0 (read) d15 to d0 (write) (write) tpcm0w tpcm1 tpcm1w tpcm1w tpcm2 tpcm2w figure 8.33 wait timing for pcmcia memory card interface
rev. 4.00, 03/04, page 234 of 660 memory card interface burst timing: in this lsi, when the ic memory card interface is selected, page mode burst access mode can be used, for read access only, by setting bits a5bst1 and a5bst0 in bcr1 for physical space area 5, or bits a6bst1 and a6bst0 in bcr1 for area 6. this burst access mode is not stipulated in jeida version 4.2 (pcmcia2.1), but allows high- speed data access using rom provided with a burst mode, etc. burst access mode timing is shown in figures 8.34 and 8.35. ckio tpcm1 a25 to a4 a3 to a0 rd/ (read) d15 to d0 (read) tpcm2 tpcm1 tpcm2 tpcm1 tpcm2 tpcm1 tpcm2 figure 8.34 basic timing for pcmcia memory card interface burst access
rev. 4.00, 03/04, page 235 of 660 ckio tpcm0 a25 to a4 a3 to a0 rd/ (read) d15 to d0 (read) tpcm1 tpcm1wtpcm1wtpcm1w tpcm2 tpcm1 tpcm1w tpcm2 tpcm2w figure 8.35 wait timing for pcmcia memory card interface burst access when the entire 32-mbyte memory space is used as ic memory card interface space, the common memory/attribute memory switching signal reg is generated using a port, etc. if 16-mbytes or less of memory space is sufficient, using 16 mbytes of memory space as common memory space and 16 mbytes as attribute memory space enables the a24 pin to be used for the reg signal. i/o card interface timing: figures 8.36 and 8.37 show the timing for the pcmcia i/o card interface. switching between the i/o card interface and the ic memory card interface is performed according to the accessed address. when pcmcia is designed for physical space area 5, the bus access is automatically performed as an i/o card interface access when a physical address from h'16000000 to h'17ffffff is accessed. when pcmcia is designated for physical space area 6, the bus access is automatically performed as an i/o card interface access when a physical address from h'1a000000 to h'1bffffff is accessed. when accessing a pcmcia i/o card, the access should be performed using a non-cacheable area in virtual space (p2 or p3 space) or an area specified as non-cacheable by the mmu.
rev. 4.00, 03/04, page 236 of 660 when an i/o card interface access is made to a pcmcia card in little-endian mode, dynamic sizing of the i/o bus width is possible using the iois16 pin. when a 16-bit bus width is set for area 5 or 6, if the iois16 signal is high during a word-size i/o bus cycle, the i/o port is recognized as being 8 bits in width. in this case, a data access for only 8 bits is performed in the i/o bus cycle being executed, followed automatically by a data access for the remaining 8 bits. figure 8.38 shows the basic timing for dynamic bus sizing. in big-endian mode, the iois16 signal is not supported. in big-endian mode, the iois16 signal should be fixed low. ckio tpci1 tpci2 a25 to a0 rd/ (read) d15 to d0 (read) i (write) d15 to d0 (write) figure 8.36 basic timing for pcmcia i/o card interface
rev. 4.00, 03/04, page 237 of 660 ckio a25 to a0 rd/ (read) (write) d15 to d0 (read) d15 to d0 (write) tpci0 tpci0w tpci1 tpci1w tpci1w tpci2 tpci2w figure 8.37 wait timing for pcmcia i/o card interface
rev. 4.00, 03/04, page 238 of 660 ckio tpci0 a25 to a1 a0 rd/ (read) d15 to d0 (read) i (write) d15 to d0 (write) tpci1 tpci1w tpci2 tpci1 tpci1w tpci2 tpci2w figure 8.38 dynamic bus sizing timing for pcmcia i/o card interface
rev. 4.00, 03/04, page 239 of 660 8.5.7 waits between access cycles a problem associated with higher external memory bus operating frequencies is that data buffer turn-off on completion of a read from a low-speed device may be too slow, causing a collision with data in the next access. this results in lower reliability or incorrect operation. to avoid this problem, a data collision prevention feature has been provided. this memorizes the preceding access area and the kind of read/write. if there is a possibility of a bus collision when the next access is started, a wait cycle is inserted before the access cycle thus preventing a data collision. there are two cases in which a wait cycle is inserted: when an access is followed by an access to a different area, and when a read access is followed by a write access from this lsi. when this lsi performs consecutive write cycles, the data transfer direction is fixed (from this lsi to other memory) and there is no problem. with read accesses to the same area, in principle, data is output from the same data buffer, and wait cycle insertion is not performed. bits aniw1 and aniw0 (n = 0, 2 to 6) in wcr1 specify the number of idle cycles to be inserted between access cycles when a physical space area access is followed by an access to another area, or when this lsi performs a write access after a read access to physical space area n. if there is originally space between accesses, the number of idle cycles inserted is the specified number of idle cycles minus the number of empty cycles. waits are not inserted between accesses when bus arbitration is performed, since empty cycles are inserted for arbitration purposes. t1 ckio a25 to a0 rd/ d31 to d0 t2 twait t1 t2 twait t1 t2 area m read area m inter-access wait specification area n inter-access wait specification area n space read area n space write figure 8.39 waits between access cycles
rev. 4.00, 03/04, page 240 of 660 8.5.8 bus arbitration whenabusreleaserequest( breq ) is received from an external device, buses are released after the bus cycle being executed is completed and a bus grant signal ( back ) is output . the bus is not released during burst transfers for cache fills or a write back and tas instruction execution between the read cycle and write cycle. bus arbitration is not executed in multiple bus cycles that are generated when the data bus width is shorter than the access size; i.e. in the bus cycles when longword access is executed for the 8-bit memory. at the negation of breq , back is negated and bus use is restarted . see appendix b, pin functions, for the pin state when the bus is released. this lsi sometimes needs to retrieve a bus it has released. for example, when memory generates a refresh request or an interrupt request internally, this lsi must perform the appropriate processing. this lsi has a bus request signal ( irqout ) for this purpose. when it must retrieve the bus, it asserts the irqout signal. devices asserting an external bus release request receive the assertion of the irqout signal and negate the breq signal to release the bus. this lsi retrieves the bus and carries out the processing. irqout irqout irqout irqout pinassertionconditions: ? when a memory refresh request has been generated but the refresh cycle has not yet begun ? when an interrupt is generated with an interrupt request level higher than the setting of the interrupt mask bits (i3 to i0) in the status register (sr). (this does not depend on the sr.bl bit.) 8.5.9 bus pull-up with this lsi, address pin pull-up can be performed when the bus is released by setting the pula bit in bcr1 to 1. the address pins are pulled up for a 4-clock period after back is asserted. figure 8.40 shows the address pin pull-up timing. similarly, data pin pull-up can be performed by setting the puld bit in bcr1 to 1. the data pins should be pulled up when the data bus is not in use. the data pin pull-up timing for a read cycle is shown in figure 8.41, and the timing for a write cycleinfigure8.42. hi-z pull-up ckio a25 to a0 figure 8.40 pins a25 to a0 pull-up timing
rev. 4.00, 03/04, page 241 of 660 pull-up ckio d31 to d0 pull-up figure 8.41 pins d31 to d0 pull-up timing (read cycle) pull-up ckio d31 to d0 pull-up figure 8.42 pins d31 to d0 pull-up timing (write cycle)
rev. 4.00, 03/04, page 242 of 660
rev. 4.00, 03/04, page 243 of 660 section 9 direct memory access controller (dmac) this chip includes a four-channel direct memory access controller (dmac). the dmac can be used in place of the cpu to perform high-speed transfers between external devices that have dack (transfer request acknowledge signal), external memory, memory-mapped external devices, and on-chip peripheral modules (scif, a/d converter, and d/a converter). using the dmac reduces the burden on the cpu and increases overall operating efficiency. figure 9.1 shows a block diagram of the dmac. 9.1 feature the dmac has the following features. ? four channels ? address space: architecturally 4-gbytes ? 8-bit, 16-bit, 32-bit, or 16-byte transfer (in 16-byte transfer, four 32-bit reads are executed, followed by four 32-bit writes.) ? maximum transfer counter: 16 mbytes (16777216 transfers) ? supports dual address mode ? direct address transfer mode: the values specified in the dmac registers indicates the transfer source and transfer destination. two bus cycles are required for one data transfer. ? indirect address transfer mode: data is transferred with the address stored prior to the address specified in the transfer source address in the dmac. other operations are the same as those of direct address transfer mode. this function is only valid in channel 3. four bus cycles are required for one data transfer. ? supports single address mode ? either the transfer source or transfer destination peripheral device is accessed (selected) by means of the dack signal, and the other device is accessed by address. one bus cycle is required for one data transfer. ? channel functions: transfer mode that can be specified is different in each channel. ? channel 0: external request can be accepted. ? channel 1: external request can be accepted. ? channel 2: this channel has a source address reload function, which reloads a source address for each 4 transfers. ? channel 3: in this channel, direct address transfer mode or indirect address transfer mode can be specified. ? reload function: the value that was specified in the source address register can be automatically reloaded every 4 dma transfers. this function is only valid in channel 2.
rev. 4.00, 03/04, page 244 of 660 ? three types of transfer requests ? external request: from two dreq pins (channels 0 and 1 only). dreq can be detected either by the falling edge or by the low level. ? on-chip module request: requests from on-chip peripheral modules such as serial communications interface (scif), a/d converter (a/d), and a timer (cmt). this request can be accepted in all the channels. ? auto request: the transfer request is generated automatically within the dmac. ? selectable bus modes: cycle-steal mode or burst mode ? selectable channel priority levels ? fixed mode: the channel priority is fixed. ? round-robin mode: the priority of the channel in which the execution request was accepted is made the lowest. ? interrupt request: an interrupt request can be generated to the cpu after transfers end by the specified counts. peripheral bus internal bus , interation control sar_n dmac module register control start-up control request priority control bus interface bus state controller on-chip peripheral module dar_n dmatcr_n chcr_n dmaor scif a/d converter cmt dei_n external ram external rom external i/o (memory mapped) external i/o (with acknowledge) dack0, dack1 drak0, drak1 dmaor: sar_n: dar_n: dmatcr_n: chcr_n: dei_n: n: dmac operation register dmac source address register dmac destination address register dmac transfer count register dmac channel control register dma transfer-end interrupt request to cpu 0 to 3 legend figure 9.1 dmac block diagram
rev. 4.00, 03/04, page 245 of 660 9.2 input/output pin table 9.1 shows the dmac pins. table 9.1 pin configuration channel name symbol i/o function dma transfer request dreq0 i dma transfer request input from external device to channel 0 dreq acknowledge dack0 o strobe output to an external i/o at dma transfer request from external device to channel 0 0 dma request acknowledge drak0 o output showing that dreq0 has been accepted dma transfer request dreq1 i dma transfer request input from external device to channel 1 dreq acknowledge dack1 o strobe output to an external i/o at dma transfer request from external device to channel 1 1 dma request acknowledge drak1 o output showing that dreq1 has been accepted 9.3 register description dmac has a total of 17 registers. each channel has four control registers. one other control register is shared by all channels. refer to section 23, list of registers, for more details of the addresses and access sizes. channel 0 ? dma source address register 0 (sar0) ? dma destination address register 0 (dar0) ? dma transfer count register 0 (dmatcr0) ? dma channel control register 0 (chcr0) channel 1 ? dma source address register 1 (sar1) ? dma destination address register 1 (dar1) ? dma transfer count register 1 (dmatcr1) ? dma channel control register 1 (chcr1)
rev. 4.00, 03/04, page 246 of 660 channel 2 ? dma source address register 2 (sar2) ? dma destination address register 2 (dar2) ? dma transfer count register 2 (dmatcr2) ? dma channel control register 2 (chcr2) channel 3 ? dma source address register 3 (sar3) ? dma destination address register 3 (dar3) ? dma transfer count register 3 (dmatcr3) ? dma channel control register 3 (chcr3) any channel ? dma operation register (dmaor) 9.3.1 dma source address registers 0 to 3 (sar_0 to sar_3) dma source address registers 0 to 3 (sar_0 to sar_3) are 32-bit read/write registers that specify the source address of a dma transfer. these registers include count functions, and during a dma transfer, these registers indicate the next source address. to transfer data in 16 bits or in 32 bits, specify the address with 16-bit or 32-bit address boundary. when transferring data in 16-byte units, a 16-byte boundary (address 16n) must be set for the source address value. specifying other addresses does not guarantee operation. the initial value is undefined by resets. the previous value is held in standby mode. when accessed in 16 bits, the other 16-bit data which has not been accessed is held. 9.3.2 dma destination address registers 0 to 3 (dar_0 to dar_3) dma destination address registers 0 to 3 (dar_0 to dar_3) are 32-bit read/write registers that specify the destination address of a dma transfer. these registers include count functions, and during a dma transfer, these registers indicate the next destination address. to transfer data in 16 bits or in 32 bits, specify the address with 16-bit or 32-bit address boundary. specifying other addresses does not guarantee operation. the initial value is undefined by resets. the previous value is held in standby mode. when accessed in 16 bits, the other 16-bit data which has not been accessed is held.
rev. 4.00, 03/04, page 247 of 660 9.3.3 dma transfer count registers 0 to 3 (dmatcr_0 to dmatcr_3) dma transfer count registers 0 to 3 (dmatcr_0 to dmatcr_3) are 24-bit read/write registers that specify the dma transfer count (bytes, words, or longwords) in each channel. the number of transfers is 1 when the setting is h'000001, and 16777216 (the maximum) when h'000000 is set. during a dma transfer, these registers indicate the remaining transfer count. to transfer data in 16 bytes, one 16-byte transfer (128 bits) counts one. upper eight bits in dmatcr are reserved. these bits are always read as 0. the write value should always be 0. when using 16-byte transfer, an integral multiple of 4 (4n) must be set for the number of transfers to ensure normal operation. the initial value is undefined by resets. the previous value is held in standby mode. bit bit name initial value r/w description 31 to 24 ?? r reserved these bits are always read as 0. the write value should always be 0. 23 to 0 ?? r/w 24-bit register 9.3.4 dma channel control registers 0 to 3 (chcr_0 to chcr_3) dma channel control registers 0 to 3 (chcr_0 to chcr_3) are 32-bit read/write registers that specifies operation mode, transfer method, or others in each channel. these register values are initialized to 0s by resets. the previous value is held in standby mode. when accessed in 16 bits, the other 16-bit data which has not been accessed is held. bit bit name initial value r/w description 31 to 21 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
rev. 4.00, 03/04, page 248 of 660 bit bit name initial value r/w description 20 di 0 (r/w) * 2 direct/indirect selection di selects direct address mode or indirect address mode in channel 3. this bit is only valid in chcr_3 and is not used in chcr_0 to chcr_2. writing to this bit is invalid in chcr_0 to chcr_2; 0 is read if this bit is read. when using 16-byte transfer, direct address mode must be specified. operation is not guaranteed if indirect address mode is specified. 0: direct address mode 1: indirect address mode 19 ro 0 (r/w) * 2 source address reload ro selects whether the source address initial value is reloaded in channel 2. this bit is only valid in chcr_2 and is not used in chcr_0 to chcr_1, or chcr_3. writing to this bit is invalid in chcr_0, chcr_1, and chcr_3; 0 is read if this bit is read. when using 16-byte transfer, this bit must be cleared to 0, specifying non- reloading. operation is not guaranteed if reloading is specified. 0: a source address is not reloaded 1: a source address is reloaded 18 rl 0 (r/w) * 2 request check level rl specifies the drak (acknowledge of dreq ) signal output is high active or low active. this bit is only valid in chcr_0 and chcr_1. writing to this bit is invalid in chcr_2 and chcr_3; 0 is read if this bit is read. 0: low-active output of drak 1: high-active output of drak 17 am 0 (r/w) * 2 acknowledge mode am specifies whether dack is output in data read cycle or in data write cycle in dual address mode. this bit is only valid in chcr_0 and chcr_1. writing to this bit is invalid in chcr_2 and chcr_3; 0 is read if this bit is read. 0: dack output in read cycle 1: dack output in write cycle
rev. 4.00, 03/04, page 249 of 660 bit bit name initial value r/w description 16 al 0 (r/w) * 2 acknowledge level al specifies the dack (acknowledge) signal output is high active or low active. this bit is only valid in chcr_0 and chcr_1. writing to this bit is invalid in chcr_2 and chcr_3; 0 is read if this bit is read. 0: low-active output of dack 1: high-active output of dack 15 14 dm1 dm0 0 0 r/w r/w destination address mode dm1 and dm0 select whether the dma destination address is incremented, decremented, or left fixed. 00: fixed destination address (initial value) 01: destination address is incremented (+1 in 8-bit transfer, +2 in 16-bit transfer, +4 in 32-bit transfer, +16 in 16-byte transfer) 10: destination address is decremented (?1 in 8-bit transfer, ?2 in 16-bit transfer, ?4 in 32-bit transfer; illegal setting in 16-byte transfer) 11: reserved (setting prohibited) 13 12 sm1 sm0 0 0 r/w r/w source address mode sm1 and sm0 select whether the dma source address is incremented, decremented, or left fixed. 00: fixed source address 01: source address is incremented (+1 in 8-bit transfer, +2 in 16-bit transfer, +4 in 32-bit transfer, +16 in 16-byte transfer) 10: source address is decremented (?1 in 8-bit transfer, ?2 in 16-bit transfer, ?4 in 32-bit transfer; illegal setting in 16-byte transfer) 11: reserved (setting prohibited) notes: if the transfer source is specified in indirect address, specify the address, in which the datatobetransferredisstoredandwhichis stored as data (indirect address), sar_3. specification of sar_3 increment or decrement in indirect address mode depends on sm1 and sm0 settings. in this case, however, the sar_3 increment or decrement value is +4, ?4, or fixed to 0 regardless of the transfer data size specified in ts1 and ts0.
rev. 4.00, 03/04, page 250 of 660 bit bit name initial value r/w description 11 10 9 8 rs3 rs2 rs1 rs0 0 0 0 0 r/w r/w r/w r/w resource select rs3 to rs0 specify which transfer requests will be sent to the dmac. 0000: external request, dual address mode 0001: reserved (setting prohibited) 0010: external request / single address mode external address space external device with dack 0011: external request / single address mode external device with dack external address space 0100: auto request 0101: reserved (setting prohibited) 0110: reserved (setting prohibited) 0111: reserved (setting prohibited) 1000: reserved (setting prohibited) 1001: reserved (setting prohibited) 1010: reserved (setting prohibited) 1011: reserved (setting prohibited) 1100: scif transmission 1101: scif reception 1110: internal a/d 1111: cmt notes: 1. external request specification is valid only in channels 0 and 1. none of the request sources can be selected in channels 2 and 3. 2. when using 16-byte transfer, the following settings must not be made: 1100 scif transmission 1101 scif reception 1110 a/d converter 1111 cmt operation is not guaranteed if these settings are made.
rev. 4.00, 03/04, page 251 of 660 bit bit name initial value r/w description 7? 0 rreserved this bit is always read 0. the write value should always be 0. 6ds0 (r/w) * 2 dreq select bit ds selects the sampling method of the dreq pin that is used in external request mode is detection in low level or at the falling edge. this bit is only valid in chcr_0 and chcr_1. writing to this bit is invalid in chcr_2 and chcr_3; 0 is read if this bit is read. in channel 0 and 1, if an on-chip peripheral module is specified as a transfer request source or an auto request is specified, specification of this bit is ignored and detection at the falling edge is fixed except in an auto-request. 0: dreq detected in low level 1: dreq detected at falling edge 5 tm 0 r/w transmit mode tm specifies the bus mode when transferring data. 0: cycle steal mode 1: burst mode 4 3 ts1 ts0 0 0 r/w r/w transmit size bits 1 and 0 ts1 and ts0 specify the size of data to be transferred. 00: byte size (8 bits) 01: word size (16 bits) 10: longword size (32 bits) 11: 16-byte unit (4 longword transfers) 2 ie 0 r/w interrupt enable bit setting this bit to 1 generates an interrupt request when data transfer end (te = 1) by the count specified in dmatcr. 0: interrupt request is not generated even if data transfer ends by the specified count 1: interrupt request is generated if data transfer ends by the specified count
rev. 4.00, 03/04, page 252 of 660 bit bit name initial value r/w description 1te 0 r/(w) * 1 transfer end te is set to 1 when data transfer ends by the count specified in dmatcr. at this time, if the ie bit is set to 1, an interrupt request is generated. before this bit is set to 1, if data transfer ends due to an nmi interrupt, a dmac address error, or clearing the de bit or the dme bit in dmaor, this bit is not set to 1. even if the de bit is set to 1 while this bit is set to 1, transfer is not enabled. 0: data transfer does not end by the count specified in dmatcr clear condition: writing 0 after te = 1 read at power-on reset or manual reset 1: data transfer ends by the specified count 0 de 0 r/w dmac enable de enables channel operation. 0: disables channel operation 1: enables channel operation note: if an auto request is specifies (specified in rs3 to rs0), transfer starts when this bit is set to 1. in an external request or an internal module request, transfer starts if transfer request is generated after this bit is set to 1. clearing this bit during transfer can terminate transfer. even if the de bit is set, transfer is not enabled if the te bit is 1, the dme bit in dmaor is 0, or the nmif bit in dmaor is 1. notes: 1. only 0 can be written to the te bit after 1 is read. 2. di, ro, rl, am, al, and ds bits are not included in some channels.
rev. 4.00, 03/04, page 253 of 660 9.3.5 dma operation register (dmaor) the dma operation register (dmaor) is a 16-bit read/write register that controls the dmac transfer mode. this register's values are initialized to 0s by resets. the previous value is held in standby mode. bit bit name initial value r/w description 15 to 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 9 8 pr1 pr0 0 0 r/w r/w priority mode pr1 and pr0 select the priority level between channels when there are transfer requests for multiple channels simultaneously. 00: ch0 > ch1 > ch2 > ch3 01: ch0 > ch2 > ch3 > ch1 10: ch2 > ch0 > ch1 > ch3 11: round-robin 7to3 ? all0 r reserved these bits are always read as 0. the write value should always be 0. 2ae 0 r/(w) * address error flag ae indicates that an address error occurred during dma transfer. if this bit is set during data transfer, transfers on all channels are suspended. the cpu cannot write 1 to this bit. 0: no dmac address error. dma transfer is enabled. clearing conditions: writing ae = 0 after ae = 1 read, power-on reset, manual reset 1: dmac address error. dma transfer is disabled. setting condition: this bit is set by occurrence of a dmac address error.
rev. 4.00, 03/04, page 254 of 660 bit bit name initial value r/w description 1nmif0 r/(w) * nmi flag nmif indicates that an nmi interrupt occurred. this bit is set regardless of whether dmac is in operating or halt state. if this bit is set during data transfer, the transfer on all channels are suspended. the cpu cannot write 1 to this bit. only 0 can be written to clear this bit after 1 is read. 0: no nmi input. dma transfer is enabled. (initial value) clearing condition: writing nmif = 0 after nmif = 1 read, power-on reset, manual reset 1: nmi input. dma transfer is disabled. setting condition: this bit is set by occurrence of an nmi interrupt. 0 dme 0 r/w dma master enable dme enables or disables dma transfers on all channels. if the dme bit and the de bit corresponding to each channel in chcr are set to 1s, transfer is enabled in the corresponding channel. if this bit is cleared during transfer, transfers on all the channels can be suspended. even if the dme bit is set, transfer is not enabled if the te bit is 1 or the de bit is 0 in chcr, or the aebitis1orthenmifbitis1indmaor. 0: disable dma transfers on all channels 1: enable dma transfers on all channels note: * only 0 can be written to the ae and nmif bits after 1 is read.
rev. 4.00, 03/04, page 255 of 660 9.4 operation when there is a dma transfer request, the dmac starts the transfer according to the predetermined channel priority order; when the transfer end conditions are satisfied, it ends the transfer. transfers can be requested in three modes: auto request, external request, and on-chip peripheral module request. the dual address mode has direct address transfer mode and indirect address transfer mode. in the bus mode, the burst mode or the cycle steal mode can be selected. 9.4.1 dma transfer flow after the dma source address registers (sar_0 to sar_3), dma destination address registers (dar_0 to dar_3), dma transfer count registers (dmatcr_0 to dmatcr_3), dma channel control registers (chcr_0 to chcr_3), and dma operation register (dmaor) are set, the dmac transfers data according to the following procedure: 1. checks to see if transfer is enabled (de = 1, dme = 1, te = 0, ae = 0, nmif = 0) 2. when a transfer request comes and transfer is enabled, the dmac transfers 1 transfer unit of data (depending on the ts0 and ts1 settings). for an auto request, the transfer begins automatically when the de bit and dme bit are set to 1. the dmatcr value will be decremented for each transfer. the actual transfer flows vary by address mode and bus mode. 3. when the specified number of transfer have been completed (when dmatcr reaches 0), the transfer ends normally. if the ie bit of the chcr is set to 1 at this time, a dei interrupt is sent to the cpu. 4. when an nmi interrupt is generated or an address error occurs during dma transfer, the transfers are suspended. transfers are also suspended when the de bit of the chcr or the dme bit of the dmaor are changed to 0. figure 9.2 is a flowchart of this procedure.
rev. 4.00, 03/04, page 256 of 660 normal end nmif = 1 or de = 0 or dme = 0? bus mode, transfer request mode, dreq detection selection system initial settings (sar, dar, dmatcr, chcr, dmaor) transfer (1 transfer unit); dmatcr ? 1 dmatcr, sar and dar updated dei interrupt request (when ie = 1) no yes no yes no yes yes no yes no * 3 * 2 start transfer aborted dmatcr = 0? transfer request occurs? * 1 de, dme = 1 and nmif, te = 0? nmif = 1 or de = 0 or dme = 0? transfer end notes: 1. in auto-request mode, transfer begins when nmif and te are all 0 and the de and dme bits are set to 1. 2. dreq = level detection in burst mode (external request) or cycle-steal mode. 3. dreq = edge detection in burst mode (external request), or auto-request mode in burst mode. figure 9.2 dmac transfer flowchart
rev. 4.00, 03/04, page 257 of 660 9.4.2 dma transfer requests dma transfer requests are basically generated in either the data transfer source or destination, but they can also be generated by external devices and on-chip peripheral modules that are neither the source nor the destination. transfers can be requested in three modes: auto request, external request, and on-chip peripheral module request. the request mode is selected in the rs3 to rs0 bits of chcr_0 to chcr_3. auto-request mode: when there is no transfer request signal from an external source, as in a memory-to-memory transfer or a transfer between memory and an on-chip peripheral module unable to request a transfer, the auto-request mode allows the dmac to automatically generate a transfer request signal internally. when the de bits of chcr_0 to chcr_3 and the dme bit of the dmaor are set to 1, the transfer begins so long as the te bits of chcr_0 to chcr_3 and the ae but and nmif bit of dmaor are all 0. external request mode: in this mode a transfer is performed at the request signal ( dreq )ofan external device. choose one of the modes shown in table 9.2 according to the application system. when this mode is selected, if the dma transfer is enabled (de = 1, dme = 1, te = 0, ae = 0, nmif = 0), a transfer is performed upon a request at the dreq input. choose to detect dreq by either the falling edge or low level of the signal input with the ds bit of chcr_0 to chcr_1 (ds = 0 is level detection, ds = 1 is edge detection). the source of the transfer request does not have to be the data transfer source or destination. table 9.2 selecting external request modes with the rs bits rs3 rs2 rs1 rs0 address mode source destination 0 0 dual address mode any * any * 0 external memory, memory-mapped external device external device with dack 00 1 1 single address mode external device with dack external memory, memory-mapped external device note: * external memory, memory-mapped external device, on-chip memory, on-chip peripheral module (excluding dmac, ubc, and bsc)
rev. 4.00, 03/04, page 258 of 660 on-chip peripheral module request: in this mode a transfer is performed at the transfer request signal (interrupt request signal) of an on-chip peripheral module. this mode cannot be set in case of 16-byte transfer. the transfer request signals include 4 signals: the receive data full interrupts (rxi) and the transmit data empty interrupts (txi) from serial communication interfaces (scif), the a/d conversion end interrupt (adi) of the a/d converter, and the compare match timer interrupt (cmi) of the cmt. when this mode is selected, if the dma transfer is enabled (de = 1, dme = 1, te = 0, ae = 0, nmif = 0), a transfer is performed upon the input of a transfer request signal. the source of the transfer request does not have to be the data transfer source or destination. when rxi is set as the transfer request, however, the transfer source must be the sci's receive data register (rdr). likewise, when txi is set as the transfer request, the transfer source must be the sci's transmit data register (tdr). and if the transfer requester is the a/d converter, thedatatransfersourcemustbethea/ddataregister(addr). table 9.3 selecting on-chip peripheral module request modes with the rs bit rs3 rs2 rs1 rs0 dma transfer request source dma transfer request signal source desti- nation bus mode 1010 1011 1100scif transmitter txi2 (scif transmit data empty interrupt transfer request) any * tdr2 burst/ cycle steal 1101scif receiver rxi2 (scif receive data full interrupt transfer request) rdr1 any * burst/ cycle steal 1110a/d converter adi (a/d conversion end interrupt) addr any * burst/ cycle steal 1111cmt cmi(comparematchtimer interrupt) any * any * burst/ cycle steal addr: a/d data register of a/d converter note: * external memory, memory-mapped external device, on-chip peripheral module (excluding dmac, ubc , and bsc) when outputting transfer requests from on-chip peripheral modules, the appropriate interrupt enable bits must be set to output the interrupt signals. if the interrupt request signal of the on-chip peripheral module is used as a dma transfer request signal, an interrupt is not generated to the cpu. the dma transfer request signals of table 9.3 are automatically withdrawn when the corresponding dma transfer is performed. if the cycle-steal mode is being used, they are withdrawn at the first transfer; if the burst mode is being used, they are withdrawn at the last transfer.
rev. 4.00, 03/04, page 259 of 660 9.4.3 channel priority when the dmac receives simultaneous transfer requests on two or more channels, it selects a channel according to a predetermined priority order. two modes (fixed mode and round-robin mode) are selected by the priority bits pr1 and pr0 in the dma operation register (dmaor). fixed mode: in this mode, the priority levels among the channels remain fixed. there are three kindsoffixedmodesasfollows: ? ch0 > ch1 > ch2 > ch3 ? ch0 > ch2 > ch3 > ch1 ? ch2 > ch0 > ch1 > ch3 these are selected by the pr1 and the pr0 bits in the dma operation register (dmaor). round-robin mode: each time one word, byte, or longword, or 16-byte data is transferred on one channel, the priority order is rotated. the channel on which the transfer was just finished rotates to the bottom of the priority order. the round-robin mode operation is shown in figure 9.3. the priority of the round-robin mode is ch0 > ch1 > ch2 > ch3 immediately after a reset.
rev. 4.00, 03/04, page 260 of 660 ch1 > ch2 > ch3 > ch0 ch0 > ch1 > ch2 > ch3 ch2 > ch3 > ch0 > ch1 ch0 > ch1 > ch2 > ch3 ch2 > ch3 > ch0 > ch1 ch0 > ch1 > ch2 > ch3 ch0 > ch1 > ch2 > ch3 ch3 > ch0 > ch1 > ch2 ch0 > ch1 > ch2 > ch3 (1) when channel 0 transfers initial priority order initial priority order initial priority order priority order afrer transfer priority order afrer transfer priority order does not change channel 2 becomes bottom priority. the priority of channels 0 and 1, which were higher than channel 2, are also shifted. if immediately after there is a request to transfer channel 1 only, channel 1 becomes bottom priority and the priority of channels 0 and 3, which were higher than channel 1, are also shifted. channel 0 becomes bottom priority. the priority of channel 0, which was higher than channel 3, is also shifted. channel 0 becomes bottom priority priority order afrer transfer priority order afrer transfer priority order afrer transfer post-transfer priority order when there is an immediate transfer request to channel 1 only (2) when channel 1 transfers (3) when channel 2 transfers (4) when channel 3 transfers figure 9.3 round-robin mode
rev. 4.00, 03/04, page 261 of 660 figure 9.4 shows how the priority order changes when channel 0 and channel 3 transfers are requested simultaneously and a channel 1 transfer is requested during the channel 0 transfer. the dmac operates as follows: 1. transfer requests are generated simultaneously to channels 0 and 3. 2. channel 0 has a higher priority, so the channel 0 transfer begins first (channel 3 waits for transfer). 3. a channel 1 transfer request occurs during the channel 0 transfer (channels 1 and 3 are both waiting) 4. when the channel 0 transfer ends, channel 0 becomes lowest priority. 5. at this point, channel 1 has a higher priority than channel 3, so the channel 1 transfer begins (channel 3 waits for transfer). 6. when the channel 1 transfer ends, channel 1 becomes lowest priority. 7. the channel 3 transfer begins. 8. when the channel 3 transfer ends, channels 3 and 2 shift downward in priority so that channel 3 becomes the lowest priority. transfer request waiting channel(s) dmac operation channel priority (1) channels 0 and 3 (3) channel 1 0 > 1 > 2 > 3 (2) channel 0 transfer start (4) channel 0 transfer ends (5) channel 1 transfer starts (6) channel 1 transfer ends (7) channel 3 transfer starts (8) channel 3 transfer ends 1 > 2 > 3 > 0 2 > 3 > 0 > 1 0 > 1 > 2 > 3 priority order changes priority order changes priority order changes none 3 3 1,3 figure 9.4 changes in channel priority in round-robin mode
rev. 4.00, 03/04, page 262 of 660 9.4.4 dma transfer types the dmac supports the transfers shown in table 9.4. the dual address mode has the direct address mode and the indirect address mode. in the direct address mode, an output address value is the data transfer target address; in the indirect address mode, the value stored in the output address, not the output address value itself, is the data transfer target address. a data transfer timing depends on the bus mode, which has cycle steal mode and burst mode. table 9.4 supported dma transfers destination source external device with dack external memory memory- mapped external device on-chip peripheral module external device with dack not available dual, single dual, single not available external memory dual, single dual dual dual memory-mapped external device dual, single dual dual dual on-chip peripheral module not available dual dual dual notes: 1. dual: dual address mode 2. single: single address mode 3. the dual address mode includes the direct address mode and the indirect address mode. 4. 16-byte transfer is not available for on-chip peripheral modules.
rev. 4.00, 03/04, page 263 of 660 address modes: ? dual address mode in the dual address mode, both the transfer source and destination are accessed (selectable) by an address. the source and destination can be located externally or internally. the dual address mode has (1) direct address transfer mode and (2) indirect address transfer mode. (1) in the direct address transfer mode, dma transfer requires two bus cycles because data is read from the transfer source in a data read cycle and written to the transfer destination in a data write cycle. at this time, transfer data is temporarily stored in the dmac. in the transfer between external memories as shown in figure 9.5, data is read to the dmac from one external memory in a data read cycle, and then that data is written to the other external memory in a write cycle. figures 9.6 to 9.8 show examples of the timing at this time. data buffer address bus data bus address bus data bus memory transfer source module transfer destination module memory transfer source module transfer destination module sar dar data buffer sar dar the sar value is an address, data is read from the transfer source module, and the data is tempolarily stored in the dmac. first bus cycle second bus cycle the dar value is an address and the value stored in the data buffer in the dmac is written to the transfer destination module. dmac dmac figure 9.5 operation in the direct address mode in the dual address mode
rev. 4.00, 03/04, page 264 of 660 (1st cycle) (2nd cycle) data read cycle data write cycle transfer source address transfer destination address ckio a25 to a0 d31 to d0 dackn note: transfer between external memories, dack output in a read cycle dack output timing is the same as that of . figure 9.6 example of dma transfer timing in the direct address mode in the dual address mode (transfer source: ordinary memory, transfer destination: ordinary memory)
rev. 4.00, 03/04, page 265 of 660 transfer source address +4 +8 +12 transfer destination address +4 +8 +12 data read cycle (1st cycle) (2nd cycle) a25 to a0 ckio dackn d31 to d0 note: transfer between external memories, dack output in a read cycle dack output timing is the same as that of . figure 9.7 example of dma transfer timing in the direct address mode in the dual address mode (16-byte transfer, transfer source: ordinary memory, transfer destination: ordinary memory) +4 +8 +12 a25 to a0 ckio rd/ dackn d31 to d0 data read cycle (1st cycle) (2nd cycle) data write cycle note: transfer between external memories, dack output in a read cycle dack output timing is the same as that of . transfer source address transfer destination address figure 9.8 example of dma transfer timing in the direct address mode in the dual address mode (16-byte transfer, transfer source: synchronous dram, transfer destination: ordinary memory)
rev. 4.00, 03/04, page 266 of 660 (2) in the indirect address transfer mode, the address of memory in which data to be transferred is stored is specified in the transfer source address register (sar_3) in the dmac. in this mode, the address value specified in the transfer source address register in the dmac is read first. this value is temporarily stored in the dmac. next, the read value is output as an address, and the value stored in that address is stored in the dmac again. then, the value read afterwards is written to the address specified in the transfer destination address; this completes one dma transfer. 16-byte transfer is not possible. figure 9.9 shows one example. in this example, the transfer destination, the transfer source, and the storage destination of the indirect address are external memories with a 16- bit width in the indirect address mode, and transfer data is 16 or 8 bits. figure 9.10 shows an example of the transfer timing.
rev. 4.00, 03/04, page 267 of 660 memory transfer source module transfer destination module sar_3 dar_3 data buffer temporary buffer d m a c when the value in sar_3 is an address, the memory data is read and the value is stored in the temporary buffer. the value to be read must be 32 bits since it is used for the address. memory transfer source module data bus address bus transfer destination module sar_3 dar_3 data buffer temporary buffer d m a c memory transfer source module data bus address bus transfer destination module sar_3 dar_3 data buffer temporary buffer d m a c first and second bus cycles when the value in the temporary buffer is an address, the data is read from the transfer source module to the data buffer. third bus cycle fourth bus cycle when the value in sar_3 is an address, the value in the data buffer is written to the transfer source module. the above description uses the memory, transfer source module, or transfer destination module; in practice, any module can be connected in the addressing space. note: data bus address bus figure 9.9 operation in the indirect address mode in the dual address mode (when the external memory space has a 16-bit width)
rev. 4.00, 03/04, page 268 of 660 ck a25 to a0 d31 to d0 transfer source address (h) transfer source address nop indirect address transfer data transfer data transfer data transfer source address internal addresu bus internal data bus dmac indirect address buffer dmac data buffer 1. the internal address bus value does not change, and controlled by the port. 2. the dmac does not fetch the value until 32-bit data is output to the internal data bus. notes: address read cycle nop cycle data read cycle nop cycle data write cycle (1st) (2nd) (3rd) (4th) indirect address transfer source address (l) transfer destination address indirect address indirect address(h) indirect address(l) transfer data transfer data nop nop * 1 * 2 figure 9.10 example of transfer timing in the indirect address mode in the dual address mode
rev. 4.00, 03/04, page 269 of 660 ? single address mode in the single address mode, either the transfer source or transfer destination external device is accessed (selected) by means of the dack signal, and the other device is accessed by address. in this mode, the dmac performs one dma transfer in one bus cycle, accessing one of the external devices by outputting the dack transfer request acknowledge signal to it, and at the same time outputting an address to the other device involved in the transfer. for example, in the case of transfer between external memory and an external device with dack, as shown in figure 9.11, when the external device outputs data to the data bus, that data is written to the external memory in the same bus cycle. dmac sh7706 dack dreq external address bus external data bus external memory external device with dack data flow figure 9.11 data flow in the single address mode two kinds of transfer are possible in the single address mode: (1) transfer between an external device with dack and a memory-mapped external device, and (2) transfer between an external device with dack and external memory. in both cases, only the external request signal (dreq) is used for transfer requests.
rev. 4.00, 03/04, page 270 of 660 figures 9.12 to 9.14 show examples of dma transfer timing in the single address mode. address output to external memory space data output from external device with dack dack signal (active-low) to external device with dack write strobe signal to external memory space address output to external memory space data output from external memory space dack signal (active-low) to external device with dack read strobe signal to external memory space (a) external device with dack external memory space (ordinary memory) (b) external memory space external device with dack (active low) cki0 a25 to a0 d31 to d0 dackn cki0 a25 to a0 d31 to d0 dackn figure 9.12 example of dma transfer timing in the single address mode
rev. 4.00, 03/04, page 271 of 660 ckio a25 to a0 d31 to d0 dackn transfer source address +4 +8 +12 figure 9.13 example of dma transfer timing in the single address mode (16- byte transfer, external memory space (ordinary memory) -> external device with dack) bus modes: there are two bus modes: cycle-steal and burst. select the mode in the tm bits of chcr_0 to chcr_3 (one byte, word, or longword, or 16-byte data). ? cycle-steal mode in the cycle-steal mode, the bus right is given to another bus master after a one-transfer-unit (8-, 16-, or 32-bit unit) dma transfer. when another transfer request occurs, the bus rights are obtained from the other bus master and a transfer is performed for one transfer unit. when that transfer ends, the bus right is passed to the other bus master. this is repeated until the transfer end conditions are satisfied. in the cycle-steal mode, transfer areas are not affected regardless of settings of the transfer request source, transfer source, and transfer destination. figure 9.14 shows an example of dma transfer timing in the cycle steal mode. transfer conditions shown in the figure are: ? dual address mode ? dreq level detection cpu cpu cpu dmac dmac cpu dmac dmac cpu cpu bus cycle bus right returned to cpu read write write read figure 9.14 dma transfer example in the cycle-steal mode
rev. 4.00, 03/04, page 272 of 660 ? burst mode in the burst mode, once the bus right is obtained, the transfer is performed continuously without passing it until the transfer end conditions are satisfied. in the external request mode with low level detection of the dreq pin, however, when the dreq pin is driven high, the bus is passed to the other bus master after the dmac transfer request that has already been accepted ends, even if the transfer end conditions have not been satisfied. the burst mode cannot be used when the serial communications interface (scif) and a/d converter are the transfer request sources. figure 9.15 shows a timing at this point. cpu cpu cpu dmac dmac dmac dmac dmac dmac cpu bus cycle read read read write write write figure 9.15 dma transfer example in the burst mode relationship between request modes and bus modes by dma transfer category: table 9.5 shows the relationship between request modes and bus modes by dma transfer category. table 9.5 relationship of request modes and bus modes by dma transfer category addres s mode transfer category request mode bus mode transfer size (bits) usable channels external device with dack and external memory external b/c 8/16/32/128 0,1 external device with dack and memory-mapped external device external b/c 8/16/32/128 0, 1 external memory and external memory all * 1 b/c 8/16/32/128 0 to 3 * 5 external memory and memory- mapped external device all * 1 b/c 8/16/32/128 0 to 3 * 5 memory-mapped external device and memory-mapped external device all * 1 b/c 8/16/32/128 0 to 3 * 5 external memory and on-chip peripheral module all * 2 b/c * 3 8/16/32 * 4 0to3 * 5 memory-mapped external device and on-chip peripheral module all * 2 b/c * 3 8/16/32 * 4 0to3 * 5 dual on-chip peripheral module and on- chip peripheral module all * 2 b/c * 3 8/16/32 * 4 0to3 * 5
rev. 4.00, 03/04, page 273 of 660 address mode transfer category request mode bus mode transfer size (bits) usable channels external device with dack and external memory external b/c 8/16/32/128 0, 1 single external device with dack and memory-mapped external device external b/c 8/16/32/128 0, 1 b: burst, c: cycle steal notes: 1. external requests, auto requests and on-chip peripheral module requests are all available. for on-chip peripheral module requests, however, scif, and a/d converter cannot be specified as the transfer request source. 2. external requests, auto requests and on-chip peripheral module requests are all available. when the scif, or a/d converter is also the transfer request source, however, the transfer destination or transfer source must be the scif, or a/d converter, respectively. 3. if the transfer request source is the scif, the cycle-steal mode is only available. 4. the access size permitted when the transfer destination or source is an on-chip peripheral module register. 5. if the transfer request is an external request, channels 0 and 1 are only available. 6. if the transfer request source is the sdram, the transfer size should be set smaller than the bus width. bus mode and channel priority order: when a given channel 1 is transferring in the burst mode and there is a transfer request to a channel 0 with a higher priority, the transfer of channel 0 will begin immediately. at this time, if the priority is set in the fixed mode (ch0 > ch1), the channel 1 transfer will continue when the channel 0 transfer has completely finished, even if channel 0 is operating in the cycle-steal mode or in the burst mode. if the priority is set in the round-robin mode, channel 1 will begin operating again after channel 0 completes the transfer of one transfer unit, even if channel 0 is in the cycle-steal mode or in the burst mode. the bus will then switch between the two in the order channel 1, channel 0, channel 1, channel 0.
rev. 4.00, 03/04, page 274 of 660 even if the priority is set in the fixed mode or in the round-robin mode, it will not give the bus to the cpu since channel 1 is in the burst mode. this example is illustrated in figure 9.16. cpu dmac ch1 dmac ch1 dmac ch0 dmac ch1 dmac ch0 dmac ch1 dmac ch1 cpu * 1 * 2 * 1 round-robin mode in dmac ch0 and ch1 dmac ch1 burst mode cpu cpu 1. cycle-steal mode 2. burst mode notes: dmac ch1 burst mode figure 9.16 bus state when multiple channels are operating (priority level is round- robin mode) 9.4.5 number of bus cycle states and dreq dreq dreq dreq pin sampling timing number of bus cycle states: when the dmac is the bus master, the number of bus cycles is controlled by the bus state controller (bsc) in the same way as when the cpu is the bus master. for details, see section 8, bus state controller (bsc). dreq dreq dreq dreq pin sampling timing: in the external request mode, the dreq pin is sampled by clock pulse (ckio) falling edge or low level detection. when dreq input is detected, a dmac bus cycle is generated and dma transfer is performed, at the earliest, three states later. the second and subsequent dreq sampling operations are started two cycles after the first sample.
rev. 4.00, 03/04, page 275 of 660 operation ? cycle-steal mode in the cycle-steal mode, the dreq sampling timing is the same regardless of whether level or edge detection is used. for example, in figure 9.17 (cycle-steal mode, level detection), dmac transfer begins, at the earliest, three cycles after the first sampling is performed. the second sampling is started two cycles after the first. if dreq is not detected at this time, sampling is performed in each subsequent cycle. thus, dreq sampling is performed one step in advance. the third sampling operation is not performed until the idle cycle following the end of the first dma transfer. the above conditions are the same whatever the number of cpu transfer cycles, as shown in figure 9.18, and whatever the number of dma transfer cycles, as shown in figure 9.19. dack is output in a read in the example in figure 9.17, and in a write in the example in figure 9.18. in both cases, dack is output for the same duration as csn . figure 9.20 illustrates the case where dreq is not detected and sampling is subsequently executed every cycle. figure 9.21 shows an example of edge detection in the cycle-steal mode. ? burst mode, level detection in the case of burst mode with level detection, the dreq sampling timing is the same as in the cycle-steal mode. for example, in figure 9.22, dmac transfer begins, at the earliest, three cycles after the first sampling is performed. the second sampling is started two cycles after the first. subsequent sampling operations are performed in the idle cycle following the end of the dma transfer cycle. in the burst mode, also, the dack output period is the same as in the cycle-steal mode. ? burst mode, edge detection in the case of burst mode with edge detection, dreq sampling is only performed once. for example, in figure 9.23, dmac transfer begins, at the earliest, three cycles after the first sampling is performed. after this, dmac transfer is executed continuously until the number of data transfers set in the dmatcr register have been completed. dreq is not sampled during this time. to restart dma transfer after it has been suspended by an nmi, first clear nmif, then input an edge request again. in the burst mode, also, the dack output period is the same as in the cycle-steal mode.
rev. 4.00, 03/04, page 276 of 660 ckio drak (high active) dack bus cycle 1st sampling 2nd sampling 3rd sampling dmac(read) cpu dmac(write) dmac(read) cpu dmac(write) figure 9.17 cycle-steal mode, level input (cpu access: 2 cycles) cpu cpu ckio drak (high active) dack dmac(read) dmac(write) dmac(read) 1st sampling 2nd sampling 3rd sampling bus cycle figure 9.18 cycle-steal mode, level input (cpu access: 3 cycles) ckio drak (high active) bus cycle dack (rd output) dmac(read) cpu dmac(write) dmac(read) cpu 1st sampling 2nd sampling 3rd sampling figure 9.19 cycle-steal mode, level input (cpu access: 2 cycles, dma rd access: 4 cycles)
rev. 4.00, 03/04, page 277 of 660 ckio drak bus cycle dack (rd output) cpu cpu dmac(write) dmac(read) dmac(write) dmac(read) cpu 3rd sampling is performed, but since is high, per-cycle sampling starts 2nd sampling is performed, but since is high, per-cycle sampling starts 1st sampling 2nd sampling 3rd sampling (high active) figure 9.20 cycle-steal mode, level input (cpu access: 2 cycles, dreq input delayed) ckio drak (high active) bus cycle dreq dack (rd output) cpu cpu dmac(write) dmac(read) dmac(write) dmac(read) cpu high high high high 3rd sampling is performed, but since there is no dreq falling edge, per-cycle sampling starts 2nd sampling is performed, but since there is no dreq falling edge, per-cycle sampling starts 1st sampling 2nd sampling 3rd sampling note: when a dreq falling edge is detected, dreq must be high for at least one cycle before the sampling point. figure 9.21 cycle-steal mode, edge input (cpu access: 2 cycles) ckio drak (high active) dack bus cycle dmac(read) dmac(write) dmac(read) dmac(write) dmac(read) cpu 1st sampling 2nd sampling 3rd sampling figure 9.22 burst mode, level input
rev. 4.00, 03/04, page 278 of 660 ckio drak (high active) dack bus cycle cpu dmac(read) dmac(write) dmac(read) dmac(write) dmac(read) 1st sampling figure 9.23 burst mode, edge input 9.4.6 source address reload function channel 2 includes a reload function, in which the value returns to the value set in the sar_2 for each four transfers by setting the ro bit in chcr_2 to 1. 16-byte transfer cannot be used. figure 9.24 shows this operation. figure 9.25 shows the timing chart of the source address reload function, which is under the following conditions: burst mode, auto request, 16-bit transfer data size, sar_2 count-up, dar_2 fixed, reload function on, and usage of only channel 2. sar_2 (initial value) dmac transfer request dmac control reload control 4 time count chcr_2 dmatcr_2 sar_2 ro bit = 1 count signal reload signal reload signal address bus figure 9.24 source address reload function diagram
rev. 4.00, 03/04, page 279 of 660 ck internal address bus internal data bus sar_2 dar_2 dar_2 dar_2 dar_2 sar_2+2 sar_2+4 sar_2+6 sar_2 sar_2 data sar_2+2 data sar_2+4 data sar_2+6 data first transfer of channel 2 second transfer third transfer fourth transfer fifth transfer sar_2 output dar_2 output sar_2+2 output dar_2 output sar_2+4 output dar_2 output sar_2+6 output dar_2 output sar_2 reload sar_2 output dar_2 output figure 9.25 timing chart of source address reload function even if the transfer data size is 8, 16, or 32 bits, a reload function can be executed. dmatcr_2, which specifies a transfer count, decrements 1 each time a transfer ends regardless of whether a reload function is on or off. consequently, be sure to specify the value multiple of four in dmatcr_2 when the reload function is on. specifying other values does not guarantee the operation. though the counters that count transfers of four times for the reload function are reset by clearing the dme bit in dmaor or the de bit in chcr_2, by setting the transfer end flag (te bit in chcr_2) by a dmac address error, or by inputting nmi, besides by resets, the sar_2, dar_2, dmatcr_2 registers are not reset. therefore, if these sources are generated, the counters that are initialized and are not initialized exist in the dmac; malfunction will be caused by restarting the dmac in that state. consequently, if these sources occur except for setting the te bit during the usage of the reload function, set sar_2, dar_2, and dmatcr_2 again.
rev. 4.00, 03/04, page 280 of 660 9.4.7 dma transfer ending conditions the dma transfer ending conditions vary for individual channels ending and all channels ending together. at transfer end, the following conditions are applied except the case where the value set in the dmatcr reaches 0. (a) cycle-steal mode (external request, internal request, and auto request) when the transfer ending conditions are satisfied, dmac transfer request acceptance is suspended. the dmac stops operating after completing the number of transfers that it has accepted until the ending conditions are satisfied. in the cycle-steal mode, the operation is the same regardless of whether the transfer request is detected by the level or at the edge. (b) burst mode, edge detection (external request, internal request, and auto request) the timing from the point where the ending conditions are satisfied to the point where the dmac stops operating differs from that in cycle steal mode. in the edge detection in the burst mode, though only one transfer request is generated to start up the dmac, stop request sampling is performed in the same timing as transfer request sampling in the cycle-steal mode. as a result, the period when stop request is not sampled is regarded as the period when transfer request is generated, and after performing the dma transfer for this period, the dmac stops operating. (c) burst mode, level detection (external request) same as described in (a). (d) bus timing when transfers are suspended the transfer is suspended when one transfer ends. even if transfer ending conditions are satisfied during read in the direct address transfer in the dual address mode, the subsequent write process is executed, and after the transfer in (a) to (c) above has been executed, dmac operation suspends.
rev. 4.00, 03/04, page 281 of 660 individual channel ending conditions: there are two ending conditions. a transfer ends when the value of the channel's dmatcr is 0, or when the de bit of the channel's chcr is cleared to 0. ? when dmatcr is 0: when the dmatcr value becomes 0 and the corresponding channel's dma transfer ends, the transfer end flag bit (te) is set in the chcr. if the ie (interrupt enable) bit has been set, a dmac interrupt (dei) is requested to the cpu. this transfer ending does not apply to conditions in (a) to (d) described above. ? when de of chcr is 0: software can halt a dma transfer by clearing the de bit in the channel's chcr. the te bit is not set when this happens. this transfer ending does not apply to conditions in (a) to (d) described above. conditions for ending all channels simultaneously: transfers on all channels end when the nmif or ae bit in the dmaor is set to 1, or when the dme bit in the dmaor is cleared to 0. ? transfersendingwhentheaebitornmifbitissetto1indmaor:whenannmiinterrupt occurs, the ae bit or nmif bit is set to 1 in the dmaor and all channels stop their transfers according to the conditions in (a) to (d) described above, and pass the bus right to other bus masters. consequently, even if the ae bit or nmi bit is set to 1 during transfer, the sar, dar, dmatcr are updated. the te bit is not set. to resume the transfers after dmac address error exception handling or nmi interrupt exception handling, clear the ae or nmif bit to 0. at this time, if there are channels that should not be restarted, clear the corresponding de bit in the chcr. ? transfers ending when dme is cleared to 0 in dmaor: clearing the dme bit to 0 in the dmaor forcibly stops the transfers on all channels. the te bit is not set. all channels stop their transfers according to the conditions in (a) to (d) in 9.4.7, dma transfer ending conditions, as in dmac address error occurrence or nmi interrupt generation. in this case, the values in sar, dar, and dmatcr are also updated.
rev. 4.00, 03/04, page 282 of 660 9.5 compare match timer (cmt) dmac has an on-chip compare match timer (cmt) to generate dma transfer request. the cmt has 16-bit counter. figure 9.26 shows a cmt block diagram. 9.5.1 feature the cmt has the following features: ? four types of counter input clock can be selected ? one of four internal clocks (p /4, p /8, p /16, p /64) can be selected. ? generate dma transfer request when compare match occurs. internal bus bus interface control circuit clock selection cmstr cmcsr cmcor comparator cmcnt module bus cmt p /4 p /8 p /16 p /64 cmstr: cmcsr: cmcor: cmcnt: legend compare match timer start register compare match timer control/status register compare match timer constant register compare match timer counter figure 9.26 cmt block diagram
rev. 4.00, 03/04, page 283 of 660 9.5.2 register description the cmt has the following registers. refer to section 23, list of registers, for more details of the addresses and access sizes. ? compare match timer start register (cmstr) ? compare match timer control/status register (cmcsr) ? compare match counter (cmcnt) ? compare match constant register (cmcor) ? compare match timer start register (cmstr) the compare match timer start register (cmstr) is a 16-bit register that selects whether to operate or halt the channel 0 and channel 1 counter (cmcnt). bit bit name initial value r/w description 15 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1? 0 r/wreserved this bit can be read or written. write 0 when writing. 0 str0 0 r/w count start 0 selects whether to operate or halt compare match timer counter 0. 0: cmcnt0 count operation halted 1: cmcnt0 count operation ? compare match timer control/status register (cmcsr) the compare match timer control/status register (cmcsr) is a 16-bit register that indicates the occurrence of compare matches, sets the enable/disable of interrupts, and establishes the clock used for incrementation. bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits always read as 0. the write value should always be 0.
rev. 4.00, 03/04, page 284 of 660 bit bit name initial value r/w description 7cmf0 r/(w) * compare match flag this flag indicates whether cmcnt and cmcor values have matched or not. 0: cmcnt and cmcor values have not matched clearing condition: write 0 to cmf after reading cmf = 1 1: cmcnt and cmcor values have matched 6? 0 r/wreserved both read and write are available. the write value should always be 0. 5to2 ? 0 r reserved these bits always read as 0. the write value should always be 0. 1 0 cks1 cks0 0 0 r/w r/w clock select 1 and 0 these bits select the clock input to the cmcnt from among the four internal clocks obtained by dividing the system clock (p ). when the str bit of the cmstr is set to 1, the cmcnt begins incrementing with the clock selected by cks1 and cks0. 00: p /4 01: p /8 10: p /16 11: p /64 note: * the only value that can be written is 0 to clear the flag. ? compare match counter (cmcnt) the compare match counter (cmcnt) is a 16-bit register used as an up-counter. when an internal clock is selected with the cks1 and cks0 bits of the cmcsr and the str bit of the cmstr is set to 1, the cmcnt begins incrementing with the selected clock. when the cmcnt value matches that of the cmcor, the cmcnt is cleared to h'0000 and the cmf flag of the cmcsr is set to 1. the cmcnt0 is initialized to h'0000 by resets. it retains its previous value in standby mode. ? compare match constant register (cmcor) the compare match constant register (cmcor) is a 16-bit register that sets the compare match period with the cmcnt. the cmcor is initialized to h'ffff by resets. it retains its previous value in standby mode.
rev. 4.00, 03/04, page 285 of 660 9.5.3 operation ? period count operation when an internal clock is selected with the cks1 and cks0 bits of the cmcsr register and the str bit of the cmstr is set to 1, the cmcnt begins incrementing with the selected clock. when the cmcnt counter value matches that of the cmcor, the cmcnt counter is cleared to h'0000 and the cmf flag of the cmcsr register is set to 1. the cmcnt counter begins counting up again from h'0000. figure 9.27 shows the compare match counter operation. counter cleared by cmcor compare match cmcnt value cmcor h'0000 time figure 9.27 counter operation ? cmcnt count timing one of four clocks (p /4, p /8, p /16, p /64) obtained by dividing the the system clock (p ) can be selected by the cks1 and cks0 bits of the cmcsr. figure 9.28 shows the timing. n+1 ck internal clock cmcnt0 input clock cmcnt0 n-1 n figure 9.28 count timing
rev. 4.00, 03/04, page 286 of 660 ? compare match flag set timing the cmf bit of the cmcsr register is set to 1 by the compare match signal generated when the cmcor register and the cmcnt counter match. the compare match signal is generated upon the final state of the match (timing at which the cmcnt counter matching count value is updated). consequently, after the cmcor register and the cmcnt counter match, a compare match signal will not be generated until a cmcnt counter input clock occurs. figure 9.29 shows the cmf bit set timing. ck cmcor cmcnt input clock compare match signal cmf cmi cmcnt n n 0 figure 9.29 cmf set timing ? compare match flag clear timing the cmf bit of the cmcsr register is cleared by writing 0 to it after reading 1. figure 9.30 shows the timing when the cmf bit is cleared by the cpu. ck cmf cmcsr0 write cycle t 1 t 2 figure 9.30 timing of cmf clear by the cpu
rev. 4.00, 03/04, page 287 of 660 9.6 examples of use 9.6.1 example of dma transfer between a/d converter and external memory (address reload on) in this example, dma transfer is performed between the on-chip a/d converter (transfer source) and the external memory (transfer destination) with address reload function on. table 9.6 shows the transfer conditions and register settings. table 9.6 transfer conditions and register settings for transfer between on-chip a/d converter and external memory transfer conditions register setting transfer source: on-chip a/d converter sar_2 h'04000080 transfer destination: external memory dar_2 h'00400000 number of transfers: 128 (reloading 32 times) dmatcr_2 h'00000080 transfer source address: incremented transfer destination address: decremented transfer request source: a/d converter bus mode: burst transfer unit: long word interrupt request generated at end of transfer chcr_2 h'00089e35 channel priority order: 0 > 2 > 3 > 1 dmaor h'0101 when the address reload function is on, the values set in sar_0 to sar_3 returns to the initially set value at each four transfers. in this example, when an interrupt request is generated from a/d converter, longword data is read from the register in address h'04000080 in a/d converter, and it is written to external memory address h'00400000. since longword data has been transferred, the values in sar_2 and dar_2 are h'04000084 and h'003ffffc, respectively. the bus right is maintained and data transfers are successively performed because this transfer is in the burst mode. after four transfers end, fifth and sixth transfers are performed if the address reload function is off, and the value in sar_2 is incremented from h'0400008c, h'04000090, h'04000094,.... if the address reload function is on, the dma transfer stops after the fourth transfer ends, the bus request signal to the cpu is cleared. at this time, the value stored in sar_2 is not incremented from h'0400008c to h'04000090, but returns to the initially set value h'04000080. the value in dar_2 continues being decremented regardless of whether the address reload function is on or off. as a result, the values in the dmac are as shown in table 9.7 when the fourth transfer ends, depending on whether the address reload function is on or off.
rev. 4.00, 03/04, page 288 of 660 table 9.7 values in the dmac after the fourth transfer ends items address reload on address reload off sar_2 h'04000080 h'04000090 dar_2 h'003ffffc h'003ffffc dmatcr_2 h'0000007c h'0000007c bus right released held dmac operation stops keeps operating interrupt not generated not generated transfer request source flag clear executed not executed notes: 1. an interrupt is generated regardless of whether the address reload function is on or off, if transfers are executed until the value in dmatcr_2 reaches 0 and the ie bit in chcr_2 has been set to 1. 2. the transfer request source flag is cleared regardless of whether the address reload function is on or off, if transfers are executed until the value in dmatcr_2 reaches 0. 3. specify the burst mode to use the address reload function. this function may not be correctly executed in the cycle steal mode. 4. set the value multiple of four in dmatcr_2 to use the address reload function. this function may not be correctly executed if other values are specified. 9.6.2 example of dma transfer between external memory and scif transmitter (indirect address on) in this example, dma transfer is performed between the external memory specified with the indirect address (transfer source) and the scif transmitter (transfer destination) using dmac channel 3. table 9.8 shows the transfer conditions and register settings. in addition, the trigger of the number of transmit fifo data is set to 1 (ttrg1 = ttrg0 = 1 in scfcr).
rev. 4.00, 03/04, page 289 of 660 table 9.8 transfer conditions and register settings for transfer between external memory and scif transmitter transfer conditions register setting transfer source: external memory sar_3 h'00400000 value stored in address h'00400000 ? h'00450000 value stored in address h'04500000 ? h'55 transfer destination: on-chip scif tdr2 dar_3 h'04000156 number of transfers: 10 dmatcr_3 h'0000000a transfer source address: incremented transfer destination address: fixed transfer request source: scif (txi2) bus mode: cycle steal transfer unit: byte no interrupt request generated at end of transfer chcr_3 h'00011c01 channel priority order: 0 > 1 > 2 > 3 dmaor h'0001 if the indirect address is on, data stored in the address set in sar_0 to sar_3 is not used as transfer source data. in the indirect address, after the value stored in the address set in sar_0 to sar_3 is read, that read value is used as an address again, and the value stored in that address is read and stored in the corresponding address set in dar_0 to dar_3. in the example shown in table 9.3, when an scif transfer request is generated, the dmac reads the value in address h'00400000 set in sar_3. since the value h'00450000 is stored in that address, the dmac reads the value h'00450000. next, the dmac uses that read value as an address again, and reads the value h'55 stored in that address. then, the dmac writes the value h'55 to address h'04000156 set in dar_3; this completes one indirect address transfer. in the indirect address, when data is read first from the address set in sar_3, the data transfer size is always longword regardless of the settings of the ts0 and the ts1 bits that specify the transfer data size. however, whether the transfer source address is fixed, incremented, or decremented is specified according to the sm0 and the sm1 bits. therefore, in this example, though the transfer data size is specified as byte, the value in sar_3 is h'00400004 when one transfer ends. write operation is the same as that in the normal dual address transfer.
rev. 4.00, 03/04, page 290 of 660 9.7 cautions 1. chcr_0 to chcr_3 can be accessed in any data size. the dma operation register (dmaor) must be accessed in byte (eight bits) or word (16 bits); other registers must be accessed in word (16 bits) or longword (32 bits). 2. before rewriting the rs0 to rs3 bits of chcr_0 to chcr_3, first clear the de bit to 0 (when rewriting chcr, be sure to clear the de bit to 0 in advance). 3. even when the nmi interrupt is input when the dmac is not operating, the nmif bit of the dmaor will be set. 4. when entering the standby mode, the dme bit in dmaor must be cleared to 0 and the transfers accepted by the dmac must end. 5. the on-chip peripherals which dmac can access are scif, a/d converter, d/a converter, and i/o ports. do not access the other peripherals by dmac. 6. when starting up the dmac, set chcr_0 to chcr_3 or dmaor last. specifying other registers last does not guarantee normal operation. 7. even if the maximum number of transfers is performed in the same channel after the dmatcr_0 to dmatcr_3 count reaches 0 and the dma transfer ends normally, write 0 to dmatcr_0 to dmatcr_3. otherwise, normal dma transfer may not be performed. 8. when using the address reload function, specify the burst mode as a transfer mode. in the cycle-steal mode, normal dma transfer may not be performed. 9. when using the address reload function, set the value multiple of four in dmatcr_0 to dmatcr_3. specifying other values does not guarantee normal operation. 10. when detecting an external request at the falling edge, keep the external request pin high when setting the dmac. 11. do not access the space ranging from h'4000062 to h'400006f, which is not used in the dmac. accessing that space may cause malfunctions. 12. the wait signal is ignored in the following cases: a. in 16-byte dma transfer or dual addressing mode, or when writing data to the external address area b. in 16-byte dma transfer or single addressing mode, or when transferring data from an external device with dack to the external address area
rev. 4.00, 03/04, page 291 of 660 section 10 clock pulse generator (cpg) the clock pulse generator (cpg) supplies all clocks to the processor and controls the power-down modes. a block diagram of the clock pulse generator is shown in figure 10.1. 10.1 feature the cpg has the following features: ? four clock modes: selection of 4 clock modes for different frequency ranges, power consumption, direct crystal input, and external clock input are available. ? three clocks generated independently: an internal clock for the cpu, cache, and tlb (i ); a peripheral clock (p ) for the on-chip supporting modules; and a bus clock (ckio) for the external bus interface. ? frequency change function: internal and peripheral clock frequencies can be changed independently using the pll circuit and divider circuit within the cpg. frequencies are changed by software using frequency control register (frqcr) settings. ? power-down mode control: the clock can be stopped for sleep mode and software standby mode and specific modules can be stopped using the module standby function.
rev. 4.00, 03/04, page 292 of 660 cap1 ckio cycle = bcyc cap2 xtal extal md2 md1 md0 frqcr internal bus bus interface stbcr pll circuit 1 ( 1, 2, 3, 4) divider 1 internal clock (i ) cycle = icyc peripheral clock (p ) cycle = pcyc standby control divider 2 clock pulse generator pll circuit 2 ( 1, 4) crystal oscillator cpg control unit clock frequency control circuit standby control circuit 1 1/2 1/3 1/4 1 1/2 1/3 1/4 1/6 bus clock (b ) cycle = bcyc legend frqcr: frequency control register stbcr: standby control register figure 10.1 block diagram of clock pulse generator
rev. 4.00, 03/04, page 293 of 660 the clock pulse generator blocks function as follows: 1. pll circuit 1: pll circuit 1 doubles, triples, quadruples, or leaves unchanged the input clock frequency from the ckio terminal. the multiplication rate is set by the frequency control register. when this is done, the phase of the leading edge of the internal clock (i ,b ,p )is controlled so that it will agree with the phase of the leading edge of the ckio pin. 2. pll circuit 2: pll circuit 2 leaves unchanged or quadruples the frequency of the crystal oscillator or the input clock frequency coming from the extal pin. the multiplication ratio is fixed by the clock operation mode. the clock operation mode is set by pins md0, md1, and md2. see table 10.3 for more information on clock operation modes. 3. crystal oscillator: this oscillator is used when a crystal oscillator element is connected to the xtal and extal pins. it operates according to the clock operating mode setting. 4. divider 1: divider 1 generates a clock at the operating frequency used by the internal clock. the operating frequency can be 1, 1/2, 1/3, or 1/4 times the output frequency of pll circuit 1, as long as it stays at or above the clock frequency of the ckio pin. the division ratio is set in the frequency control register. 5. divider 2: divider 2 generates a clock at the operating frequency used by the bus clock (b ) and peripheral clock (p ). the operating frequency of the peripheral clock can be 1, 1/2, 1/3, 1/4, or 1/6 times the output frequency of pll circuit 1, as long as it stays at or below the clock frequency of the ckio pin. the division ratio is set in the frequency control register. 6. clock frequency control circuit: the clock frequency control circuit controls the clock frequency using the md2 to md0 pins and the frequency control register. 7. standby control circuit: the standby control circuit controls the state of the clock pulse generator and other modules during clock switching and sleep/standby modes. 8. frequency control register: the frequency control register has control bits assigned for the following functions: clock output/non-output from the ckio pin, on/off control of pll circuit 1, pll standby, the frequency multiplication ratio of pll 1, and the frequency division ratio of the internal clock and the peripheral clock. 9. standby control register: the standby control register has bits for controlling the power-down modes. see section 22, power-down modes, for more information.
rev. 4.00, 03/04, page 294 of 660 10.2 input/output pin table 10.1 lists the cpg pins and their functions. table 10.1 clock pulse generator pins and functions pin name symbol i/o description md0 i md1 i mode control pins md2 i set the clock operating mode. xtal o connects a crystal oscillator. crystal i/o pins (clock input pins) extal i connects a crystal oscillator. also used to input an external clock. clock i/o pin ckio i/o inputs or outputs an external clock. cap1 i connects capacitor for pll circuit 1 operation (recommended value 470 pf). capacitor connection pins for pll cap2 i connects capacitor for pll circuit 2 operation (recommended value 470 pf). 10.3 clock operating modes table 10.2 shows the relationship between the mode control pin (md2 to md0) combinations and the clock operating modes. table 10.3 shows the usable frequency ranges in the clock operating modes and frequency ranges of the input clock (crystal oscillation). operation cannot be guaranteed if settings other than those listed in table 10.3 are used. table 10.2 clock operating modes pin values clock i/o mode md2 md1 md0 source output pll2 on/off pll1 on/off divider 1 input divider 2 input ckio frequency 0000 extalckio on, multiplication ratio: 1 on pll1 output pll1 (extal) 1001 extalckio on, multiplication ratio: 4 on pll1 output pll1 (extal) 4 2010 crystal oscillator ckio on, multiplication ratio: 4 on pll1 output pll1 (crystal) 4 7 1 1 1 ckio ? off on pll1 output pll1 (ckio) ? other than the above reserved (setting disabled)
rev. 4.00, 03/04, page 295 of 660 mode 0: an external clock is input from the extal pin and undergoes waveform shaping by pll circuit 2 before being supplied inside this lsi. the frequency ratio between extal input clock and ckio output clock is 1:1. an input clock frequency of 25 mhz to 66.67 mhz can be used, and the ckio frequency range is 25 mhz to 66.67 mhz. mode 1: an external clock is input from the extal pin and its frequency is multiplied by 4 by pll circuit 2 before being supplied inside this lsi, allowing a low-frequency external clock to be used. the frequency ratio between extal input clock and ckio output clock is 1:4. an input clock frequency of 6.25 mhz to 16.67 mhz can be used, and the ckio frequency range is 25 mhz to 66.67 mhz. mode 2: the on-chip crystal oscillator operates, with the oscillation frequency being multiplied by 4 by pll circuit 2 before being supplied inside this lsi, allowing a low crystal frequency to be used. the frequency ratio between crystal oscillation and ckio output clock is 1:4. a crystal oscillation frequency of 6.25 mhz to 16.67 mhz can be used, and the ckio frequency range is 25 mhz to 66.67 mhz. mode 7: in this mode, the ckio pin is an input, an external clock is input to this pin, and undergoes waveform shaping, and also frequency multiplication according to the setting, by pll circuit 1 before being supplied to this lsi. in modes 0 to 2, the system clock is generated from the output of this lsi's ckio pin. consequently, if a large number of ics are operating synchronized with the clock, the ckio pin load will be large. this mode, however, assumes a comparatively large-scale system. if a large number of ics are operating on the clock cycle, a clock generator with a number of low-skew clock outputs can be provided, so that the ics can operate synchronously by distributing the clocks to each one. as pll circuit 1 compensates for fluctuations in the ckio pin load, this mode is suitable for connection of synchronous dram.
rev. 4.00, 03/04, page 296 of 660 table 10.3 available combination of clock mode and frqcr values clock mode frqcr pll1 pll2 clock rate * (i:b:p) input frequency range ckio frequency range h'0100 on ( 1) on ( 1) 1:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'0101 on ( 1) on ( 1) 1:1:1/2 25 mhz to 66.67 mhz 25 mhz to 66.67 mhz h'0102 on ( 1) on ( 1) 1:1:1/4 25 mhz to 66.67 mhz 25 mhz to 66.67 mhz h'0111 on ( 2) on ( 1) 2:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'0112 on ( 2) on ( 1) 2:1:1/2 25 mhz to 66.67 mhz 25 mhz to 66.67 mhz h'0115 on ( 2) on ( 1) 1:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'0116 on ( 2) on ( 1) 1:1:1/2 25 mhz to 66.67 mhz 25 mhz to 66.67 mhz h'0122 on ( 4) on ( 1) 4:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'0126 on ( 4) on ( 1) 2:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'012a on ( 4) on ( 1) 1:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'a100 on ( 3) on ( 1) 3:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'a101 on ( 3) on ( 1) 3:1:1/2 25 mhz to 44.44 mhz 25 mhz to 44.44 mhz h'e100 on ( 3) on ( 1) 1:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz 0 h'e101 on ( 3) on ( 1) 1:1:1/2 25 mhz to 44.44 mhz 25 mhz to 44.44 mhz h'0100 on ( 1) on ( 4) 4:4:4 6.25 mhz to 8.34 mhz 25 mhz to 33.34 mhz h'0101 on ( 1) on ( 4) 4:4:2 6.25 mhz to 16.67 mhz 25 mhz to 66.67 mhz h'0102 on ( 1) on ( 4) 4:4:1 6.25 mhz to 16.67 mhz 25 mhz to 66.67 mhz h'0111 on ( 2) on ( 4) 8:4:4 6.25 mhz to 8.34 mhz 25 mhz to 33.34 mhz h'0112 on ( 2) on ( 4) 8:4:2 6.25 mhz to 16.67 mhz 25 mhz to 66.67 mhz h'0115 on ( 2) on ( 4) 4:4:4 6.25 mhz to 8.34 mhz 25 mhz to 33.34 mhz h'0116 on ( 2) on ( 4) 4:4:2 6.25 mhz to 16.67 mhz 25 mhz to 66.67 mhz h'0122 on ( 4) on ( 4) 16:4:4 6.25 mhz to 8.34 mhz 25 mhz to 33.34 mhz h'0126 on ( 4) on ( 4) 8:4:4 6.25 mhz to 8.34 mhz 25 mhz to 33.34 mhz h'012a on ( 4) on ( 4) 4:4:4 6.25 mhz to 8.34 mhz 25 mhz to 33.34 mhz h'a100 on ( 3) on ( 4) 12:4:4 6.25 mhz to 8.34 mhz 25 mhz to 33.34 mhz h'a101 on ( 3) on ( 4) 12:4:2 6.25 mhz to 11.11 mhz 25 mhz to 44.44 mhz h'e100 on ( 3) on ( 4) 4:4:4 6.25 mhz to 8.34 mhz 25 mhz to 33.34 mhz 1, 2 h'e101 on ( 3) on ( 4) 4:4:2 6.25 mhz to 11.11 mhz 25 mhz to 44.44 mhz
rev. 4.00, 03/04, page 297 of 660 clock mode frqcr pll1 pll2 clock rate * (i:b:p) input frequency range ckio frequency range h'0100 on ( 1) off 1:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'0101 on ( 1) off 1:1:1/2 25 mhz to 66.67 mhz 25 mhz to 66.67 mhz h'0102 on ( 1) off 1:1:1/4 25 mhz to 66.67 mhz 25 mhz to 66.67 mhz h'0111 on ( 2) off 2:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'0112 on ( 2) off 2:1:1/2 25 mhz to 66.67 mhz 25 mhz to 66.67 mhz h'0115 on ( 2) off 1:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'0116 on ( 2) off 1:1:1/2 25 mhz to 66.67 mhz 25 mhz to 66.67 mhz h'0122 on ( 4) off 4:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'0126 on ( 4) off 2:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'012a on ( 4) off 1:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'a100 on ( 3) off 3:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz h'a101 on ( 3) off 3:1:1/2 25 mhz to 44.44 mhz 25 mhz to 44.44 mhz h'e100 on ( 3) off 1:1:1 25 mhz to 33.34 mhz 25 mhz to 33.34 mhz 7 h'e101 on ( 3) off 1:1:1/2 25 mhz to 44.44 mhz 25 mhz to 44.44 mhz note: * taking input clock as 1 max. frequency: i = 133.34 mhz, b (ckio) = 66.67 mhz, p = 33.34 mhz cautions: 1. the input to divider 1 is the output of the pll circuit 1: ? when pll circuit 1 is on. 2. the input of divider 2 is the output of the pll circuit 1. 3. the frequency of the internal clock (i ): ? the frequency of the internal clock (i ) is the product of the frequency of the ckio pin, the frequency multiplication ratio of pll circuit 1, and the division ratio of divider 1 when pll circuit 1 is on. ? do not set the internal clock frequency lower than the ckio pin frequency. 4. the frequency of the peripheral clock (p ): ? the frequency of the peripheral clock (p ) is the product of the frequency of the ckio pin, the frequency multiplication ratio of pll circuit 1, and the division ratio of divider 2. ? the peripheral clock frequency should not be set higher than the frequency of the ckio pin, higher than 33 mhz, or lower than 1/8 the internal clock (i ). 5. the output frequency of pll circuit 1 is the product of the ckio frequency and the multiplication ratio of pll circuit 1. 6. 1, 2, 3, or 4 can be used as the multiplication ratio of pll circuit 1. 1, 1/2, 1/ 3, and 1/4 can be selected as the division ratios of dividers 1 and 2. set the rate in the frequency control register. the on/off state of pll circuit 2 and the multiplication ratio are determined by the mode.
rev. 4.00, 03/04, page 298 of 660 10.4 register description the cpg includes the following register. refer to section 23, list of registers, for more details of the addresses and access sizes. ? frequency control register (frqcr) 10.4.1 frequency control register (frqcr) the frequency control register (frqcr) is a 16-bit read/write register used to specify, the frequency multiplication ratio of pll circuit 1, and the frequency division ratio of the internal clock and the peripheral clock. only word access can be used on the frqcr register. the frqcr register is initialized to h'0102 at a power-on reset by the resetp pin and retains its previous value at a manual reset or in standby mode. bit bit name initial value r/w description 15 5 4 stc2 stc1 stc0 0 0 0 r/w r/w r/w frequency multiplication ratio these bits specify the frequency multiplication ratio of pll circuit 1. 000: 1 001: 2 100: 3 010: 4 other than the above: reserved (setting prohibited) note: do not set the output frequency of pll circuit 1 higher than 133 mhz. 14 3 2 ifc2 ifc1 ifc0 0 0 0 r/w r/w r/w internal clock frequency division ratio these bits specify the frequency division ratio (divider 1)of the internal clock with respect to the output frequency of pll circuit 1. 000: 1 001: 1/2 100: 1/3 010: 1/4 other than the above: reserved (setting prohibited) note: do not set the internal clock frequency lower than the ckio frequency.
rev. 4.00, 03/04, page 299 of 660 bit bit name initial value r/w description 13 1 0 pfc2 pfc1 pfc0 0 0 0 r/w r/w r/w peripheral clock frequency division ratio these bits specify the division ratio (divider 2)of the peripheral clock frequency with respect to the frequency of the output frequency of pll circuit 1 or the frequency of the ckio pin. 000: 1 001: 1/2 100: 1/3 010: 1/4 101: 1/6 other than the above: reserved (setting prohibited) note: do not set the peripheral clock frequency higher than the frequency of the ckio pin. 12 to 9, 7, 6 ? 0 r reserved these bits are always read as 0. the write value should always be 0. 8? 0 rreserved this bit is always read as 1. the write value should always be 1. note: take enough care because the positions of the bits are not continuous.
rev. 4.00, 03/04, page 300 of 660 10.5 operation the frequency of the internal clock and peripheral clock can be changed either by changing the multiplication rate of pll circuit 1 or by changing the division rates of dividers 1 and 2. all of these are controlled by software through the frequency control register. the methods are described below. 10.5.1 changing the multiplication rate a pll settling time is required when the multiplication rate of pll circuit 1 is changed. the on- chip wdt counts the settling time. refer to section 11, watchdog timer (wdt), for more details. 1. in the initial state, the multiplication rate of pll circuit 1 is 1. 2. set a value that will become the specified oscillation settling time in the wdt and stop the wdt. the following must be set: wtcsr register tme bit = 0: wdt stops wtcsr register cks2 to cks0 bits: division ratio of wdt count clock wtcnt counter: initial counter value 3. set the desired value in the stc2, stc1 and stc0 bits. the division ratio can also be set in theifc2toifc0bitsandpfc2topfc0bits. 4. the processor pauses internally and the wdt starts incrementing. at this time, the internal (i ) and peripheral clocks (p ) both stop, and the clock is continuously output to the ckio pin in clock modes 0 to 2. 5. supply of the clock that has been set begins at wdt count overflow, and the processor begins operating again. the wdt stops after it overflows. 10.5.2 changing the division ratio the wdt will not count unless the multiplication rate is changed simultaneously. 1. in the initial state, ifc2 to ifc0 = 000andpfc2topfc0 = 010. 2. set the ifc2, ifc1, ifc0, pfc2, pfc1, and pfc0 bits to the new division ratio. the values that can be set are limited by the clock mode and the multiplication rate of pll circuit 1. note that if the wrong value is set, the processor will malfunction. 3. the clock is immediately supplied at the new division ratio.
rev. 4.00, 03/04, page 301 of 660 10.6 usage note when using an external crystal oscillator: place the crystal oscillator, capacitors cl1 and cl2, close to the extal and xtal pins. to prevent induction from interfering with correct oscillation, use a common grounding point for the capacitors connected to the oscillator, and do not locate a wiring pattern near these components. note: the values for cl1, and cl2 should be determined after consultation with the crystal oscillator manufacturer. xtal extal this lsi cl2 cl1 avoid crossing signal lines figure 10.2 points for attention when using crystal oscillator decoupling capacitors: as far as possible, insert a laminated ceramic capacitor of 0.1 to 1 f as a passive capacitor for each v ss /v cc pair. mount the passive capacitors as close as possible to the sh7706 power supply pins, and use components with a frequency characteristic suitable for the chip's operating frequency, as well as a suitable capacitance value. digital system v ss /v cc pairs: 11 to 13, 19 to 21, 25 to 27, 37 to 39, 49 to 51, 61 to 63, 84 to 86, 93 to 95, 115 to 117, 137 to 139, 148 to 150, 156 to 158 on-chip oscillator v ss /v cc pairs: 1 to 4, 123 to 125, 126 to 128 when using a pll oscillator circuit: keep the wiring from the pll v cc and v ss connection pattern to the power supply pins short, and make the pattern width large, to minimize the inductance component. ground the oscillation stabilization capacitors c1 and c2 to v ss (pll1) and v ss (pll2), respectively. place c1 and c2 close to the cap1 and cap2 pins and do not locate a wiring pattern in the vicinity. in clock mode 7, connect the extal pin to v cc qorv ss and leave the xtal pin open.
rev. 4.00, 03/04, page 302 of 660 cap2 v cc (pll2) v cc (pll1) v cc c1 = 470 pf c2 = 470 pf v ss cap1 v ss (pll2) v ss (pll1) avoid crossing signal lines power supply reference values c2 c1 figure 10.3 points for attention when using pll oscillator circuit notes on wiring power supply pins: to avoid crossing signal lines, wire v cc ? pll1, v cc ? pll2, and v ss ? pll2 as three patterns from the power supply source on the board so that they are independent of digital v cc and v ss .
rev. 4.00, 03/04, page 303 of 660 section 11 watchdog timer (wdt) the wdt is a single-channel timer that counts the clock settling time and is used when clearing software standby mode and temporary standbys, such as frequency changes. it can also be used as an ordinary watchdog timer or interval timer. figure 11.1 shows a block diagram of the wdt. wtcsr standby control bus interface wtcnt divider clock selector clock standby mode peripheral clock standby cancellation reset control clock selection wdt overflow internal reset request interrupt control interrupt request wtcsr: wtcnt: watchdog timer control/status register watchdog timer counter legend figure 11.1 block diagram of the wdt 11.1 feature the wdt has the following features: ? can be used to ensure the clock setting time: use the wdt to cancel software standby mode and the temporary standbys that occur when the clock frequency is changed. ? can switch between watchdog timer mode and interval timer mode. ? generates internal resets in watchdog timer mode: internal resets occur after counter overflow. selection of power-on reset or manual reset. ? generates interrupts in interval timer mode: internal timer interrupts occur after counter overflow. ? selection of eight counter input clocks. eight clocks ( 1to 1/4096) can be obtained by dividing the peripheral clock.
rev. 4.00, 03/04, page 304 of 660 11.2 register description the wdt has two registers that select the clock, switch the timer mode, and perform other functions. refer to section 23, list of registers, for more details of the addresses and access sizes. ? watchdog timer counter (wtcnt) ? watchdog timer control/status register (wtcsr) 11.2.1 watchdog timer counter (wtcnt) the watchdog timer counter (wtcnt) is an 8-bit read/write register that increments on the selected clock. when an overflow occurs, it generates a reset in watchdog timer mode and an interrupt in interval time mode. the wtcnt is initialized to h'00 only by a power-on reset through the resetp pin. use a word access to write to the wtcnt, with h'5a in the upper byte. use a byte access to read wtcnt. bit bit name initial value r/w description 7to0 ? all 0 r/w 8-bit counter note: the watchdog timer counter (wtcnt) is more difficult to write to than other registers to prevent from the erroneous writing to the register. refer to section 11.2.3 notes on register access. 11.2.2 watchdog timer control/status register (wtcsr) the watchdog timer control/status register (wtcsr) is an 8-bit read/write register composed of bits to select the clock used for the count, bits to select the timer mode, and overflow flags. the wtcsr is initialized to h'00 only by a power-on reset through the resetp pin. when a wdt overflow causes an internal reset, the wtcsr retains its value. when used to count the clock settling time for canceling a software standby, it retains its value after counter overflow. use a word access to write to the wtcsr, with h'a5 in the upper byte. use a byte access to read wtcsr.
rev. 4.00, 03/04, page 305 of 660 bit bit name initial value r/w description 7 tme 0 r/w timer enable starts and stops timer operation. clear this bit to 0 when using the wdt in software standby mode or when changing the clock frequency. 0: timer disabled: count-up stops and wtcnt value is retained 1: timer enabled 6wt/ it 0 r/w timer mode select selects whether to use the wdt as a watchdog timer or an interval timer. 0: use as interval timer 1: use as watchdog timer note: if wt/ it is modified when the wdt is running, the up-count may not be performed correctly. 5 rsts 0 r/w reset select selects the type of reset when the wtcnt overflows in watchdog timer mode. in interval timer mode, this setting is ignored. 0: power-on reset 1: manual reset 4 wovf 0 r/w watchdog timer overflow indicates that the wtcnt has overflowed in watchdog timer mode. this bit is not set in interval timer mode. 0: no overflow 1: wtcnt has overflowed in watchdog timer mode 3 iovf 0 r/w interval timer overflow indicates that the wtcnt has overflowed in interval timer mode. this bit is not set in watchdog timer mode. 0: no overflow 1: wtcnt has overflowed in interval timer mode
rev. 4.00, 03/04, page 306 of 660 bit bit name initial value r/w description 2to0 cks2to cks0 0 r/w clock select 2 to 0 these bits select the clock to be used for the wtcnt count from the eight types obtainable by dividing the peripheral clock. the overflow period in the table is the value when the peripheral clock (p )is15mhz. clock division ratio overflow period (when p =15mhz) 000: 1 17 s 001: 1/4 68 s 010: 1/16 273 s 011: 1/32 546 s 100: 1/64 1.09 ms 101: 1/256 4.36 ms 110: 1/1024 17.48 ms 111: 1/4096 69.91 ms note: if bits cks2 to cks0 are modified when the wdt is running, the up-count may not be performed correctly. ensure that these bits are modified only when the wdt is not running. note: the watchdog timer control/status register (wtcsr) is more difficult to write to than other registers to prevent from the erroneous writing to the register. refer to 11.2.3, notes on register access. 11.2.3 notes on register access the wtcnt and wtcsr are more difficult to write to than other registers. the procedure for writing to these registers are given below. writing to wtcnt and wtcsr: these registers must be written by a word transfer instruction. they cannot be written by a byte or longword transfer instruction. when writing to wtcnt, set the upper byte to h'5a and transfer the lower byte as the write data, as shown in figure 11.2. when writing to wtcsr, set the upper byte to h'a5 and transfer the lower byte as the write data. this transfer procedure writes the lower byte data to wtcnt or wtcsr. 15 8 7 0 h'5a write data address: h'ffffff84 wtcnt write 15 8 7 0 h'a5 write data address: h'ffffff86 wtcsr write figure 11.2 writing to wtcnt and wtcsr
rev. 4.00, 03/04, page 307 of 660 11.3 operation 11.3.1 canceling software standbys the wdt can be used to cancel software standby mode with an nmi or other interrupts. the procedure is described below. (the wdt does not run when resets are used for canceling, so keep the resetp pin or resetm pin low until the clock stabilizes.) 1. before transitioning to software standby mode, always clear the tme bit in wtcsr to 0. when the tme bit is 1, an erroneous reset or interval timer interrupt may be generated when the count overflows. 2. set the type of count clock used in the cks2 to cks0 bits in wtcsr and the initial values for the counter in the wtcnt counter. these values should ensure that the time till count overflow is longer than the clock oscillation settling time. 3. move to software standby mode by executing a sleep instruction to stop the clock. 4. the wdt starts counting by detecting the edge change of the nmi signal or detecting interrupts. 5. when the wdt count overflows, the cpg starts supplying the clock and the processor resumes operation. the wovf flag in wtcsr is not set when this happens. 6. since the wdt continues counting from h'00, set the stby bit in the stbcr register to 0 in the interrupt processing program and this will stop the wdt. when the stby bit remains 1, the sh7706 again enters the standby mode when the wdt has counted up to h'80. this standby mode can be canceled by power-on resets. 11.3.2 changing the frequency to change the frequency used by the pll, use the wdt. when changing the frequency only by switching the divider, do not use the wdt. 1. before changing the frequency, always clear the tme bit in wtcsr to 0. when the tme bit is 1, an erroneous reset or interval timer interrupt may be generated when the count overflows. 2. set the type of count clock used in the cks2 to cks0 bits of wtcsr and the initial values for the counter in the wtcnt counter. these values should ensure that the time till count overflow is longer than the clock oscillation settling time. 3. when the frequency control register (frqcr) is written, the clock stops and the processor enters standby mode temporarily. the wdt starts counting. 4. when the wdt count overflows, the cpg resumes supplying the clock and the processor resumes operation. the wovf flag in wtcsr is not set when this happens. 5. the counter stops at the values h'00 to h'01. the stop value depends on the clock ratio. 6. confirm that the value of wtcnt is h?00 before writing wtcnt, when wtcnt is written after the frequency change.
rev. 4.00, 03/04, page 308 of 660 11.3.3 using watchdog timer mode 1. set the wt/ it bit in the wtcsr register to 1, set the reset type in the rsts bit, set the type of count clock in the cks2 to cks0 bits, and set the initial value of the counter in the wtcnt counter. 2. set the tme bit in wtcsr to 1 to start the count in watchdog timer mode. 3. while operating in watchdog timer mode, rewrite the counter periodically to h'00 to prevent the counter from overflowing. 4. when the counter overflows, the wdt sets the wovf flag in wtcsr to 1 and generates the type of reset specified by the rsts bit. the counter then resumes counting. when a reset occurs, and a high level is output from the status0 and status1 pins. the signal output period is about one cycle of the count clock for power-on reset, and about five cycles of the peripheral clock for manual reset. 11.3.4 using interval timer mode when operating in interval timer mode, interval timer interrupts are generated at every overflow of the counter. this enables interrupts to be generated at set periods. 1. clear the wt/ it bit in the wtcsr register to 0, set the type of count clock in the cks2 to cks0 bits, and set the initial value of the counter in the wtcnt counter. 2. set the tme bit in wtcsr to 1 to start the count in interval timer mode. 3. when the counter overflows, the wdt sets the iovf flag in wtcsr to 1 and an interval timer interrupt request is sent to intc. the counter then resumes counting.
rev. 4.00, 03/04, page 309 of 660 section 12 timer unit(tmu) this lsi uses a three-channel (channels 0 to 2) 32-bit timer unit (tmu). figure 12.1 shows a block diagram of the tmu. 12.1 feature the tmu has the following features: ? each channel is provided with an auto-reload 32-bit down counter ? channel 2 is provided with an input capture function ? all channels are provided with 32-bit constant registers and 32-bit down counters that can be read or written to at any time ? all channels generate interrupt requests when the 32-bit down counter underflows (h'00000000 h'ffffffff) ? allows selection between 6 counter input clocks: external clock (tclk), on-chip rtc output clock (16 khz), p /4, p /16, p /64, p /256. (p is the internal clock for peripheral modules.) note: see section 10, clock pulse generator (cpg), for more information. ? all channels can operate when this lsi is in software standby mode: when the rtc output clock is being used as the counter input clock, this lsi is still able to count in software standby mode. ? synchronized read: tcnt is a sequentially changing 32-bit register. since the peripheral module used has an internal bus width of 16 bits, a time lag can occur between the time when the upper 16 bits and lower 16 bits are read. to correct the discrepancy in the counter read value caused by this time lag, a synchronization circuit is built into the tcnt so that the entire 32-bit data in the tcnt can be read at once. ? the maximum operating frequency of the 32-bit counter is 2 mhz on all channels: operate the sh7706 so that the clock input to the timer counters of each channel (obtained by dividing the external clock and internal clock with the prescaler) does not exceed the maximum operating frequency.
rev. 4.00, 03/04, page 310 of 660 tocr prescaler tstr tcr_0 tcnt_0 module bus internal bus tcor_0 tcr_1 tcnt_1 tcor_1 counter controller tclk p rtcclk tuni0 bus interface ch. 0 interrupt controller interrupt controller interrupt controller counter controller counter controller tuni1 tuni2 ticpi2 tcr_2 tcpr_2 tcnt_2 tcor_2 tmu ch. 1 ch. 2 clock controller tocr: tstr: tcr_n: timer output control register timer start register tcnt_n: tcor_n: tcpr_2: 32-bit timer counter 32-bit timer constant register 32-bit input capture register timer control register (n: 0, 1, 2) legend figure 12.1 tmu block diagram
rev. 4.00, 03/04, page 311 of 660 12.2 input/output pin table 12.1 shows the pin configuration of the tmu. table 12.1 pin configuration channel pin i/o description clock input/clock output tclk i/o external clock input pin/input capture control input pin/realtime clock (rtc) output pin 12.3 register description the tmu has the following registers. refer to section 23, list of registers, for more details of the addresses and access sizes. ? timer output control register (tocr) ? timer start register (tstr) ? timer constant register 0 (tcor_0) ? timer counter 0 (tcnt_0) ? timer control register 0 (tcr_0) ? timer constant register 1 (tcor_1) ? timer counter 1 (tcnt_1) ? timer control register 1 (tcr_1) ? timer constant register 2 (tcor_2) ? timer counter 2 (tcnt_2) ? timer control register 2 (tcr_2) ? input capture register 2 (tcpr_2)
rev. 4.00, 03/04, page 312 of 660 12.3.1 timer output control register (tocr) tocr is an 8-bit read/write register that selects whether to use the external tclk pin as an external clock or an input capture control usage input pin, or an output pin for the on-chip rtc output clock. tocr is initialized to h'00 by a power-on reset or manual reset, but is not initialized in standby mode. bit bit name initial value r/w description 7to1 ? all0 r reserved these bits are always read as 0. the write value should always be 0. 0 tcoe 0 r/w timer clock pin control selects use of the timer clock pin (tclk) as an external clock output pin or input pin for input capture control for the on-chip timer, or as an output pin for the on-chip rtc output clock. as the tclk pin is multiplexed as the pte6 pin, when the tclk pin is used, bits pe6md1 and ph7md0 in the pecr register should be set to 00 (other function). 0: timer clock pin (tclk) used as external clock input or input capture control input pin for the on-chip timer 1: timer clock pin (tclk) used as output pin for on- chip rtc output clock
rev. 4.00, 03/04, page 313 of 660 12.3.2 timer start register (tstr) tstr is an 8-bit read/write register that selects whether to run or halt the timer counters (tcnt_0 to tcnt_2) for channels 0 to 2. tstr is initialized to h'00 by a power-on reset or manual reset, but is not initialized in standby mode when the input clock selected for the channel is the on-chip rtc clock (rtcclk). it is initialized in standby mode, changing the multiplying ratio of pll circuit 1 or mstp2 bit in stbcr is set to a logic one only when an external clock (tclk) or the peripheral clock (p )isusedastheinputclock. bit bit name initial value r/w description 7to3 ? all0 r reserved these bits are always read 0. the write value should always be 0. 2 str2 0 r/w counter start 2 selects whether to run or halt timer counter 2 (tcnt_2). 0: halt tcnt_2 count 1: start tcnt_2 counting 1 str1 0 r/w counter start 1 selects whether to run or halt timer counter 1 (tcnt_1). 0: halt tcnt_1 count 1: start tcnt_1 counting 0 str0 0 r/w counter start 0 selects whether to run or halt timer counter 0 (tcnt_0). 0: halt tcnt_0 count 1: start tcnt_0 counting
rev. 4.00, 03/04, page 314 of 660 12.3.3 timer control registers 0 to 2 (tcr_0 to tcr_2) the timer control registers (tcr_0 to tcr_2) control the timer counters (tcnt_0 to tcnt_2) and interrupts. the tmu has three tcr_0 to tcr_2 registers for each channel. the tcr_0 to tcr_2r registers are 16-bit read/write registers that control the issuance of interrupts when the flag indicating timer counter (tcnt_0 to tcnt_2) underflow has been set to 1, and also carry out counter clock selection. when the external clock has been selected, they also select its edge. additionally, tcr_2 controls the channel 2 input capture function and the issuance of interrupts during input capture. the tcr_0 to tcr_2 are initialized to h'0000 by a power-on reset and manual reset. they are not initialized in standby mode. in cases of channel 0 and 1: bit bit name initial value r/w description 15 to 9 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 8 unf 0 r/w underflow flag status flag that indicates occurrence of a tcnt_0 and tcnt_1 underflow. 0: tcnt has not underflowed. [clearing condition] when0iswrittentounf 1: tcnt has underflowed. [setting condition] when tcnt_0 and tcnt_1 underflows * note: * contents do not change when 1 is written to unf. 7, 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5 unie 0 r/w underflow interrupt control controls enabling of interrupt generation when the status flag (unf) indicating tcnt_0 and tcnt_1 underflow has been set to 1. 0: interrupt due to unf (tuni) is not enabled. 1: interrupt due to unf (tuni) is enabled.
rev. 4.00, 03/04, page 315 of 660 bit bit name initial value r/w description 4 3 ckeg1 ckeg0 0 0 r/w r/w clock edge 1 and 0 these bits select the external clock edge when the external clock is selected, or when the input capture function is used. 00: count/capture register set on rising edge 01: count/capture register set on falling edge 1x: count/capture register set on both rising and falling edge note:x:don'tcare 2 1 0 tpsc2 tpsc1 tpsc0 0 0 0 r/w r/w r/w timer prescalers 2 to 0 these bits select the tcnt_0 and tcnt_1 count clock. 000: internal clock: count on p /4 001: internal clock: count on p / 16 010: internal clock: count on p /64 011: internal clock: count on p /256 100: internal clock: count on clock output of on-chip rtc (rtcclk) 101: external clock: count on tclk pin input 110: reserved (setting prohibited) 111: reserved (setting prohibited)
rev. 4.00, 03/04, page 316 of 660 in case of channel 2: bit bit name initial value r/w description 15 to 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 9 icpf 0 r input capture interrupt flag a function of channel 2 only: the flag is set when input capture is requested via the tclk pin. 0: no input capture request has been issued. clearing condition: when 0 is written to icpf 1: input capture has been requested via the tclk pin. setting condition: when an input capture is requested via the tclk pin * note: * contents do not change when 1 is written to icpf. 8 unf 0 r/w underflow flag status flag that indicates occurrence of a tcnt_2 underflow. 0: tcnt has not underflowed. clearing condition: when 0 is written to unf 1: tcnt has underflowed. setting condition: when tcnt_2 underflows * note: * contents do not change when 1 is written to unf. 7 6 icpe1 icpe0 0 0 r/w r/w input capture control a function of channel 2 only: determines whether the input capture function can be used, and when used, whether or not to enable interrupts. when using this input capture function it is necessary to set the tclk pin to input mode with the tcoe bit in the tocr register. additionally, use the ckeg bit to designate use of either the rising or falling edge of the tclk pin to set the value of tcnt_2 in tcpr_2. 00: input capture function is not used. 01: reserved (setting prohibited) 10: input capture function is used. interrupt due to icpf (ticpi2) are not enabled. 11: input capture function is used. interrupt due to icpf (ticpi2) are enabled.
rev. 4.00, 03/04, page 317 of 660 bit bit name initial value r/w description 5 unie 0 r/w underflow interrupt control controls enabling of interrupt generation when the status flag (unf) indicating tcnt_2 underflow has been set to 1. 0: interrupt due to unf (tuni) is not enabled. 1: interrupt due to unf (tuni) is enabled. 4 3 ckeg1 ckeg0 0 0 r/w r/w clock edge these bits select the external clock edge when the external clock is selected, or when the input capture function is used. 00: count/capture register set on rising edge 01: count/capture register set on falling edge 1x: count/capture register set on both rising and falling edge note: x: don't care. 2 1 0 tpsc2 tpsc1 tpsc0 0 0 0 r/w r/w r/w timer prescalers these bits select the tcnt_2 count clock. 000: internal clock: count on p /4 001: internal clock: count on p / 16 010: internal clock: count on p /64 011: internal clock: count on p /256 100: internal clock: count on clock output of on-chip rtc (rtcclk) 101: external clock: count on tclk pin input 110: reserved (setting prohibited) 111: reserved (setting prohibited) 12.3.4 timer constant registers 0 to 2 (tcor_0 to tcor_2) tcor_0 to tcor_2 are specified the setting value for tcnt_0 to tcnt_2 when tcnt_0 to tcnt_2 are underflowed. tmu has 3 timer constant registers, one for each channel. tcor_0 to tcor_2 is a 32-bit read/write register. tcor is initialized to h'ffffffff by a power-on reset or manual reset; it is not initialized in standby mode, and retains its contents.
rev. 4.00, 03/04, page 318 of 660 12.3.5 timer counters 0 to 2 (tcnt_0 to tcnt_2) tcnt counts down according to the input of a clock. the timer counters are 32-bit read/write registers. the tmu has three timer counters, one for each channel.the clock input is selected using the tpsc2 to tpsc0 bits in the tcr_0 to tcr_2. when a tcnt count-down results in an underflow (h'00000000 h'ffffffff), the underflow flag (unf) in the timer control register (tcr) of the relevant channel is set. the tcor value is simultaneously set in tcnt itself and the count-down continues from that value. because the internal bus for this lsi on-chip supporting modules is 16 bits wide, a time lag can occur between the time when the upper 16 bits and lower 16 bits are read. since tcnt counts sequentially, this time lag can create discrepancies between the data in the upper and lower halves. to correct the discrepancy, a buffer register is connected to tcnt so that upper and lower halves are not read separately. the entire 32-bit data in tcnt can thus be read at once. tcnt is initialized to h'ffffffff by a power-on reset or manual reset; it is not initialized in standby mode, and retains its contents. 12.3.6 input capture register 2 (tcpr_2) the input capture register (tcpr_2) is a read-only 32-bit register built only into timer 2. control of tcpr_2 setting conditions due to the tclk pin is affected by the input capture function bits (icpe1/icpe2 and ckeg1/ckeg0) in tcr2. when a tcpr_2 setting indication due to the tclk pin occurs, the value of tcnt_2 is copied into tcpr_2. tcnt_2 is not initialized by a power-on reset or manual reset, or in standby mode.
rev. 4.00, 03/04, page 319 of 660 12.4 operation each of three channels has a 32-bit timer counter (tcnt_0 to tcnt_2) and a 32-bit timer constant register (tcor_0 to tcor_2). the tcnt counts down. the auto-reload function enables synchronized counting and counting by external events. channel 2 has an input capture function. 12.4.1 counter operation when the str0 to str2 bits in tstr are set to 1, the corresponding timer counter (tcnt) starts counting. when a tcnt underflows, the unf flag of the corresponding timer control register (tcr) is set. at this time, if the unie bit in tcr is 1, an interrupt request is sent to the cpu. also at this time, the value is copied from tcor to tcnt and the down-count operation is continued. ? an example of the count operation setting flow the count operation is shown in figure 12.2. select operation select counter clock set underflow interrupt generation set timer constant register initialize timer counter start counting (1) (2) (4) (5) (6) set interrupt generation when using input capture function (3) note: when an interrupt has been generated, clear the flag in the interrupt handler that caused it. if interrupts are enabled without clearing the flag, another interrupt will be generated. select the counter clock with the tpsc0-tpsc2 bits in the timer control register. if the external clock is selected, set the tclk pin to input mode with the toce bit in tocr, and select its edge with the ckeg1 and ckeg0 bits in the timer control register. use the unie bit in the timer control register to set whether to generate an interrupt when timer counter underflows. when using the input capture function, set the icpe bits in the timer control register, including the choice of whether or not to use the interrupt function (channel 2 only). set a value in the timer constant register (the cycle is the set value plus 1). set the initial value in the timer counter. set the str bit in the timer start register to 1 to start operation. (1) (2) (3) (4) (5) (6) figure 12.2 setting the count operation
rev. 4.00, 03/04, page 320 of 660 ? auto-reload count operation figure 12.3 shows the tcnt auto-reload operation. tcnt value tcor h'00000000 str0 to str2 unf tcor value set to tcnt during underflow time figure 12.3 auto-reload count operation ? tcnt count timing 1. internal clock operation: set the tpsc2 to tpsc0 bits in tcr to select whether peripheral module clock p or one of the four internal clocks created by dividing it is used (p /4, p /16, p /64, p /256). figure 12.4 shows the timing. p internal clock timer counter input clock tcnt n + 1 n n ? 1 figure 12.4 count timing when internal clock is operating
rev. 4.00, 03/04, page 321 of 660 2. external clock operation: set the tpsc2 to tpsc0 bits in tcr to select the external clock (tclk) as the timer clock. use the ckeg1 and ckeg0 bits in tcr to select the detection edge. rise, fall or both may be selected. the pulse width of the external clock must be at least 1.5 peripheral module clock cycles for single edges or 2.5 peripheral module clock cycles for both edges. a shorter pulse width will result in accurate operation. figure 12.5 shows the timing for both-edge detection. p ? 1 figure 12.5 count timing when external clock is operating (both edges detected) 3. on-chip rtc clock operation: set the tpsc2 to tpsc0 bits in tcr to select the on-chip rtc clock as the timer clock. figure 12.6 shows the timing. rtc output clock tcnt tcnt input clock n + 1 n n ? 1 figure 12.6 count timing when on-chip rtc clock is operating
rev. 4.00, 03/04, page 322 of 660 12.4.2 input capture function channel 2 has an input capture function (figure 12.7). when using the input capture function, set the tclk pin to input mode with the tcoe bit in the timer output control register (tocr) and set the timer operation clock to internal clock or on-chip rtc clock with the tpcs2 to tpcs0 bits in the timer control register (tcr_2). also, designate use of the input capture function and whether to generate interrupts on using it with the ipce1 and ipce0 bits in tcr_2, and designate the use of either the rising or falling edge of the tclk pin to set the timer counter (tcnt_2) value into the input capture register (tcpr_2) with the ckeg1 and ckeg0 bits in tcr_2. the input capture function cannot be used in standby mode. tcnt_2 value tcor_2 h'00000000 tclk tcpr_2 set tcnt_2 value icpi tcor_2 value set to tcnt_2 during underflow time figure 12.7 operation timing when using the input capture function (using tclk rising edge)
rev. 4.00, 03/04, page 323 of 660 12.5 interrupts there are two sources of tmu interrupts: underflow interrupts (tuni) and interrupts when using the input capture function (ticpi2). 12.5.1 status flag set timing unf is set to 1 when the tcnt underflows. figure 12.8 shows the timing. p figure 12.8 unf set timing 12.5.2 status flag clear timing the status flag can be cleared by writing 0 from the cpu. figure 12.9 shows the timing. p figure 12.9 status flag clear timing
rev. 4.00, 03/04, page 324 of 660 12.5.3 interrupt sources and priorities the tmu produces underflow interrupts for each channel. when the interrupt request flag and interrupt enable bit are both set to 1, the interrupt is requested. codes are set in the exception event register (intevt, intevt2) for these interrupts and interrupt processing occurs according to the codes. the relative priorities of channels can be changed using the interrupt controller (see section 4, exception processing, and section 6, interrupt controller (intc)). table 12.2 lists tmu interrupt sources. table 12.2 tmu interrupt sources channel interrupt source description priority 0 tuni0 underflow interrupt 0 high 1 tuni1 underflow interrupt 1 2 tuni2 underflow interrupt 2 ticpi2 input capture interrupt 2 low 12.6 usage note 12.6.1 writing to registers synchronization processing is not performed for timer counting during register writes. when writing to registers, always clear the appropriate start bits for the channel (str2 to str0) in the timer start register (tstr) to halt timer counting. 12.6.2 reading registers synchronization processing is performed for timer counting during register reads. when timer counting and register read processing are performed simultaneously, the register value before tcnt counting down (with synchronization processing) is read.
rev. 4.00, 03/04, page 325 of 660 section 13 realtime clock (rtc) this lsi has a realtime clock (rtc) with its own 32.768-khz crystal oscillator. a block diagram of the rtc is shown in figure 13.1. 13.1 feature the rtc has following features: ? clock and calendar functions (bcd display): seconds, minutes, hours, date, day of the week, month, and year ? 1-hz to 64-hz timer (binary display) ? start/stop function ? 30-second adjust function ? alarm interrupt: frame comparison of seconds, minutes, hours, date, day of the week, and month can be used as conditions for the alarm interrupt ? cyclic interrupts: the interrupt cycle may be 1/256 second, 1/64 second, 1/16 second, 1/4 second, 1/2 second, 1 second, or 2 seconds ? carry interrupt: a carry interrupt indicates when a carry occurs during a counter read ? automatic leap year correction
rev. 4.00, 03/04, page 326 of 660 module bus rtc internal bus interrupt control circuit prescaler ( 2) rtcclk bus interface carry detection circuit ati pri cui r64cnt reset rseccnt rmincnt rhrcnt rwkcnt 16.384 khz rdaycnt rmoncnt ryrcnt comparator rsecar rminar rhrar rwkar rdayar rcr1 rcr2 30- second adj extal2 32.768 khz 128 hz xtal2 externally connected circuit oscillator circuit prescaler ( 128) rmonar r64cnt: rseccnt: rmincnt: rhrcnt: rwkcnt: rdaycnt: rmoncnt: ryrcnt: 64-hz counter second counter minute counter hour counter day of the week counter date counter month counter year counter rsecar: rhrar: rminar: rwkar: rdayar: rmonar: rcr1: rcr2: second alarm register minute alarm register hour alarm register day of the week alarm register date alarm register month alarm register rtc control register 1 rtc control register 2 legend figure 13.1 rtc block diagram
rev. 4.00, 03/04, page 327 of 660 13.2 input/output pin table 13.1 shows the rtc pin configuration. table 13.1 rtc pin configuration pin abbreviation i/o description rtc oscillator crystal pin extal2 i connects crystal to rtc oscillator * 2 rtc oscillator crystal pin xtal2 o connects crystal to rtc oscillator * 2 clock input/clock output tclk i/o external clock input pin/input capture control input pin/realtime clock (rtc) output pin (shared by tmu) dedicated power-supply pin for rtc v cc -rtc ? dedicated power-supply pin for rtc * 1 dedicated gnd pin for rtc v ss -rtc ? dedicated gnd pin for rtc * 1 notes: 1. except for in hardware standby mode, even if only the rtc is used (software standby mode), power must be supplied to all power supply pins, including these rtc power supply pins. in hardware standby mode, it is possible to stop supplying power to the power supply pins except for the rtc power supply pins. 2. pull-up (vcc) extal2, and open (nc) xtal2 when the rtc is not used. 13.3 register description rtc has the registers listed below. refer to section 23, list ot registers, for more detail of the address and access size. ? 64-hz counter (r64cnt) ? second counter (rseccnt) ? minute counter (rmincnt) ? hour counter (rhrcnt) ? day of week counter (rwkcnt) ? date counter (rdaycnt) ? month counter (rmoncnt) ? year counter (ryrcnt) ? second alarm register (rsecar) ? minute alarm register (rminar) ? hour alarm register (rhrar) ? day of week alarm register (rwkar) ? date alarm register (rdayar) ? month alarm register (rmonar) ? rtc control register 1 (rcr1) ? rtc control register 2 (rcr2)
rev. 4.00, 03/04, page 328 of 660 13.3.1 64-hz counter (r64cnt) the 64-hz counter (r64cnt) is an 8-bit read-only register that indicates the state of the rtc divider circuit between 64 hz and 1 hz. r64cnt is reset to h'00 by setting the reset bit in rcr2 or the adj bit in rcr2 to 1. r64cnt is not initialized by a power-on reset or manual reset, or in standby mode. bit bit name initial value r/w description 7 ? 0 r always read as 0. 6to0 ?? r 64hz counter each bit (bits 6 to 0) indicates the state of the rtc divider circuit between 64 and 1hz. bit frequency 6: 1hz 5: 2hz 4: 4hz 3: 8hz 2: 16hz 1: 32hz 0: 64hz 13.3.2 second counter (rseccnt) the second counter (rseccnt) is an 8-bit read/write register used for setting/counting in the bcd-coded second section of the rtc. the count operation is performed by a carry for each second of the 64 - hz counter. the range of second can be set is 00 to 59 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2. rseccnt is not initialized by a power-on reset or manual reset, or in standby mode. bit bit name initial value r/w description 7 ? 0 r always read as 0. 6to4 ?? r/w counter for 10-unit of second in the bcd-code. the range can be set from 0 to 5 (decimal). 3to0 ?? r/w counter for 1-unit of second in the bcd-code. the range can be set from 0 to 9 (decimal).
rev. 4.00, 03/04, page 329 of 660 13.3.3 minute counter (rmincnt) the minute counter (rmincnt) is an 8-bit read/write register used for setting/counting in the bcd-coded minute section of the rtc. the count operation is performed by a carry for each minute of the second counter. the range of minute can be set is 00 to 59 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2. rmincnt is not initialized by a power-on reset or manual reset, or in standby mode. bit bit name initial value r/w description 7 ? 0 r always read as 0. 6to4 ?? r/w counter for 10-unit of minute in the bcd-code. the range can be set from 0 to 5 (decimal). 3to0 ?? r/w counter for 1-unit of minute in the bcd-code. the range can be set from 0 to 9 (decimal). 13.3.4 hour counter (rhrcnt) the hour counter (rhrcnt) is an 8-bit read/write register used for setting/counting in the bcd- coded hour section of the rtc. the count operation is performed by a carry for each 1 hour of the minute counter. the range of hour can be set is 00 to 23 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2. rhrcnt is not initialized by a power-on reset or manual reset, or in standby mode. bit bit name initial value r/w description 7, 6 ? all 0 r always read as 0. 5, 4 ?? r/w counter for 10-unit of hour in the bcd-code. the range can be set from 0 to 2 (decimal). 3to0 ?? r/w counter for 1-unit of hour in the bcd-code. the range can be set from 0 to 9 (decimal).
rev. 4.00, 03/04, page 330 of 660 13.3.5 day of the week counter (rwkcnt) the day of the week counter (rwkcnt) is an 8-bit read/write register used for setting/counting in the bcd-coded day of week section of the rtc. the count operation is performed by a carry for each day of the date counter. the range for day of the week can be set is 0 to 6 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2. rwkcnt is not initialized by a power-on reset or manual reset, or in standby mode. bit bit name initial value r/w description 7to3 ? all 0 r always read as 0. 2to0 ?? r/w counter for the day of week in the bcd-code. the range can be set from 0 to 6 (decimal). code day of week 0: sunday 1: monday 2: tuesday 3: wednesday 4: thursday 5: friday 6: saturday
rev. 4.00, 03/04, page 331 of 660 13.3.6 date counter (rdaycnt) the date counter (rdaycnt) is an 8-bit read/write register used for setting/counting in the bcd- coded date section of the rtc. the count operation is performed by a carry for each day of the hour counter. the range of date can be set is 01 to 31 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2. rdaycnt is not initialized by a power-on reset or manual reset, or in standby mode. the rdaycnt range that can be set changes with each month and in leap years. please confirm the correct setting. bit bit name initial value r/w description 7, 6 ? all 0 r always read as 0. 5, 4 ?? r/w counter for 10-unit of date in the bcd-code. the range can be set from 0 to 3 (decimal). 3to0 ?? r/w counter for 1-unit of date in the bcd-code. the range can be set from 0 to 9 (decimal). 13.3.7 month counter (rmoncnt) the month counter (rmoncnt) is an 8-bit read/write register used for setting/counting in the bcd-coded month section of the rtc. the count operation is performed by a carry for each month of the date counter. the range of month can be set is 00 to 12 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2. rmoncnt is not initialized by a power-on reset or manual reset, or in standby mode. bit bit name initial value r/w description 7to5 ? all 0 r always read as 0. 4 ?? r/w counter for 10-unit of month in the bcd-code. the range can be set from 0 to 1 (decimal). 3to0 ?? r/w counter for 1-unit of month in the bcd-code. the range can be set from 0 to 9 (decimal).
rev. 4.00, 03/04, page 332 of 660 13.3.8 year counter (ryrcnt) the year counter (ryrcnt) is an 8-bit read/write register used for setting/counting in the bcd- coded year section of the rtc. the least significant 2 digits of the western calendar year are displayed. the count operation is performed by a carry for each year of the month counter. the range for year can be set is 00 to 99 (decimal). errant operation will result if any other value is set. carry out write processing after halting the count operation with the start bit in rcr2 or using a carry flag. ryrcnt is not initialized by a power-on reset or manual reset, or in standby mode. leap years are recognized by dividing the year counter value by 4 and obtaining a fractional result of 0. bit bit name initial value r/w description 7to4 ?? r/w counter for 10-unit of year in the bcd-code. the range can be set from 0 to 9 (decimal). 3to0 ?? r/w counter for 1-unit of year in the bcd-code. the range can be set from 0 to 9 (decimal). 13.3.9 second alarm register (rsecar) the second alarm register (rsecar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded second section counter rseccnt of the rtc. when the enb bit is set to 1, a comparison with the rseccnt value is performed. from among the rsecar/rminar/rhrar/rwkar/rdayar/rmonar registers, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range of second can be set is 00 to 59 (decimal). errant operation will result if any other value is set. the enb bit in rsecar is initialized to 0 by a power-on reset. the remaining rsecar fields are not initialized by a power-on reset or manual reset, or in standby mode.
rev. 4.00, 03/04, page 333 of 660 bit bit name initial value r/w description 7 ? 0 r/w second alarm enable 0: no compared 1: compared 6to4 ?? r/w setting value for 10-unit of second alarm in the bcd-code. the range can be set from 0 to 5 (decimal). 3to0 ?? r/w setting value for 1-unit of second alarm in the bcd-code. the range can be set from 0 to 9 (decimal). 13.3.10 minute alarm register (rminar) the minute alarm register (rminar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded minute section counter rmincnt of the rtc. when the enb bit is set to 1, a comparison with the rmincnt value is performed. from among the rsecar/rminar/rhrar/rwkar/rdayar/rmonar registers, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range of minute can be set is 00 to 59 (decimal). errant operation will result if any other value is set. the enb bit in rminar is initialized by a power-on reset. the remaining rminar fields are not initialized by a power-on reset or manual reset, or in standby mode. bit bit name initial value r/w description 7 enb 0 r/w minute alarm enable 0: no compared 1: compared 6to4 ?? r/w setting value for 10-unit of minute alarm in the bcd- code. the range can be set from 0 to 5 (decimal). 3to0 ?? r/w setting value for 1-unit of minute alarm in the bcd- code. the range can be set from 0 to 9 (decimal).
rev. 4.00, 03/04, page 334 of 660 13.3.11 hour alarm register (rhrar) the hour alarm register (rhrar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded hour section counter rhrcnt of the rtc. when the enb bit is set to 1, a comparison with the rhrcnt value is performed. from among the rsecar/rminar/rhrar/rwkar/rdayar/rmonar registers, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range of hour can be set is 00 to 23 (decimal). errant operation will result if any other value is set. the enb bit in rhrar is initialized by a power-on reset. the remaining rhrar fields are not initialized by a power-on reset or manual reset, or in standby mode. bit bit name initial value r/w description 7 enb 0 r/w hour alarm enable 0: no compared 1: compared 6 ? 0 r always read as 0. 5, 4 ?? r/w setting value for 10-unit of hour alarm in the bcd-code. the range can be set from 0 to 2 (decimal). 3to0 ?? r/w setting value for 1-unit of hour alarm in the bcd-code. the range can be set from 0 to 9 (decimal).
rev. 4.00, 03/04, page 335 of 660 13.3.12 day of the week alarm register (rwkar) the day of the week alarm register (rwkar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded day of week section counter rwkcnt of the rtc. when the enb bit is set to 1, a comparison with the rwkcnt value is performed. from among the rsecar/rminar/rhrar/rwkar/rdayar/rmonar registers, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range of day of the week can be set 0 to 6 (decimal). errant operation will result if any other value is set. the enb bit in rwkar is initialized by a power-on reset. the remaining rwkar fields are not initialized by a power-on reset or manual reset, or in standby mode. bit bit name initial value r/w description 7 enb 0 r/w day of the week alarm enable 0: no compared 1: compared 6to3 ? all 0 r always read as 0. 2to0 ?? r/w setting value for day of the week alarm in the bcd-code. the range can be set from 0 to 6 (decimal). code day of the week 0: sunday 1: monday 2: tuesday 3: wednesday 4: thursday 5: friday 6: saturday
rev. 4.00, 03/04, page 336 of 660 13.3.13 date alarm register (rdayar) the date alarm register (rdayar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded date section counter rdaycnt of the rtc. when the enb bit is set to 1, a comparison with the rdaycnt value is performed. from among the registers rsecar, rminar, rhrar, rwkar, rdayar, rmonar, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range of date can be set 01 to 31 (decimal). errant operation will result if any other value is set. the rdaycnt range that can be set changes with some months and in leap years. please confirm the correct setting. the enb bit in rdayar is initialized by a power-on reset. the remaining rdayar fields are not initialized by a power-on reset or manual reset, or in standby mode. bit bit name initial value r/w description 7 enb 0 r/w date alarm enable 0: no compared 1: compared 6 ? 0 r always read as 0. 5, 4 ?? r/w setting value for 10-unit of date alarm in the bcd-code. the range can be set from 0 to 3 (decimal). 3to0 ?? r/w setting value for 1-unit of date alarm in the bcd-code. the range can be set from 0 to 9 (decimal).
rev. 4.00, 03/04, page 337 of 660 13.3.14 month alarm register (rmonar) the month alarm register (rmonar) is an 8-bit read/write register, and an alarm register corresponding to the bcd-coded month section counter rmoncnt of the rtc. when the enb bit is set to 1, a comparison with the rmoncnt value is performed. from among the registers rsecar, rminar, rhrar, rwkar, rdayar, rmonar, the counter and alarm register comparison is performed only on those with enb bits set to 1, and if each of those coincide, an rtc alarm interrupt is generated. the range of month can be set 01 to 12 (decimal). errant operation will result if any other value is set. the enb bit in rmonar is initialized by a power-on reset. the remaining rmonar fields are not initialized by a power-on reset or manual reset, or in standby mode. bit bit name initial value r/w description 7 enb 0 r/w month alarm enable 0: no compared 1: compared 6, 5 ? all 0 r always read as 0. 4 ?? r/w setting value for 10-unit of month alarm in the bcd-code. the range can be set from 0 to 1 (decimal). 3to0 ?? r/w setting value for 1-unit of month alarm in the bcd-code. the range can be set from 0 to 9 (decimal).
rev. 4.00, 03/04, page 338 of 660 13.3.15 rtc control register 1 (rcr1) the rtc control register 1 (rcr1) is an 8-bit read/write register that affects carry flags and alarm flags. it also selects whether to generate interrupts for each flag. because flags are sometimes set after an operand read, do not use this register in read-modify-write processing. rcr1 is initialized to h'00 by a power-on reset. in a manual reset, all bits are initialized to 0 except for the cf flag, which is undefined. when using the cf flag, it must be initialized beforehand. this register is not initialized in standby mode. bit bit name initial value r/w description 7 cf 0 r/w carry flag status flag that indicates that a carry has occurred. cf is set to 1 when a count-up to r64cnt or rseccnt occurs. a count register value read at this time cannot be guaranteed; another read is required. 0: no count up of r64cnt or rseccnt. [clearing condition] when0iswrittentocf 1: count up of r64cnt or rseccnt. [setting condition] when1iswrittentocf 6, 5 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 4 cie 0 r/w carry interrupt enable flag when the carry flag (cf) is set to 1, the cie bit enables interrupts. 0: a carry interrupt is not generated when the cf flag is set to 1 1: a carry interrupt is generated when the cf flag is set to 1 3 aie 0 r/w alarm interrupt enable flag when the alarm flag (af) is set to 1, the aie bit allows interrupts. 0: an alarm interrupt is not generated when the af flag is set to 1 1: an alarm interrupt is generated when the af flag is set to 1
rev. 4.00, 03/04, page 339 of 660 bit bit name initial value r/w description 2, 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 0af0 r/walarmflag theafflagissetto1whenthealarmtimesetinan alarm register (only registers with enb bit set to 1) matches the clock and calendar time. this flag is cleared to 0 when 0 is written, but holds the previous valuewhen1istobewritten. 0: clock/calendar and alarm register have not matched since last reset to 0. [clearing condition] when0iswrittentoaf 1: [setting condition] clock/calendar and alarm register have matched (only registers that enb bit is 1) 13.3.16 rtc control register 2 (rcr2) the rtc control register 2 (rcr2) is an 8-bit read/write register for periodic interrupt control, 30- second adjustment adj, divider circuit reset, and rtc count start/stop control. it is initialized to h'09 by a power-on reset. it is initialized except for rtcen and start by a manual reset. it is not initialized in standby mode, and retains its contents. bit bit name initial value r/w description 7 pef 0 r/w periodic interrupt flag indicates interrupt generation with the period designated by the pes bits. when set to 1, pef generates periodic interrupts. 0: interrupts not generated with the period designated by the pes bits. [clearing condition] when0iswrittentopef 1: interrupts generated with the period designated by the pes bits. [setting condition] when1iswrittentopef
rev. 4.00, 03/04, page 340 of 660 bit bit name initial value r/w description 6 5 4 pes2 pes1 pes0 0 0 0 r/w r/w r/w periodic interrupt flags these bits specify the periodic interrupt. 000: no periodic interrupts generated 001: periodic interrupt generated every 1/256 second 010: periodic interrupt generated every 1/64 second 011: periodic interrupt generated every 1/16 second 100: periodic interrupt generated every 1/4 second 101: periodic interrupt generated every 1/2 second 110: periodic interrupt generated every 1 second 111: periodic interrupt generated every 2 seconds 3 rtcen 1 r/w controls the operation of the crystal oscillator for the rtc. 0: halts the crystal oscillator for the rtc. 1: runs the crystal oscillator for the rtc. 2 adj 0 r/w 30 second adjustment when 1 is written to the adj bit, times of 29 seconds or less will be rounded to 00 seconds and 30 seconds or more to 1 minute. the divider circuit will be simultaneously reset. this bit always reads 0. 0: runs normally. 1 : 30-second adjustment. 1 reset 0 r/w reset when 1 is written, initializes the divider circuit (rtc prescaler and r64cnt). this bit always reads 0. 0: runs normally. 1: divider circuit is reset. 0start1 r/wstartbit halts and restarts the counter (clock). 0: second/minute/hour/day/week/month/year counter halts. 1: second/minute/hour/day/week/month/year counter runs normally. note: the r64cnt always runs unless stopped with the rtcen bit.
rev. 4.00, 03/04, page 341 of 660 13.4 rtc operation 13.4.1 initial settings of registers after power-on all the registers should be set after the power is turned on. 13.4.2 setting the time figure 13.2 shows how to set the time when the clock is stopped. this works when the entire calendar or clock is to be set. itiseasytosetthetimeusingasoftwareprogram. write 0 to start and 1 to reset in the rcr2 register order is irrelevant write 1 to start in the rcr2 register set seconds, minutes, hour, day, day of the week, month and year stop clock, reset divider circuit to reset the divider circuit (rtc prescaler and r64cnt) and set the counter start clock figure 13.2 setting the time
rev. 4.00, 03/04, page 342 of 660 13.4.3 reading the time figure 13.3 shows how to read the time. if a carry occurs while reading the time, the correct time will not be obtained, so it must be read again. part (a) in figure 13.3 shows the method of reading the time without using interrupts; part (b) in figure 13.3 shows the method using carry interrupts. to keep programming simple, method (a) should normally be used. write 0 to cf in rcr1 note: set af in rcr1 to 1 so that alarm flag is not cleared. write 0 to cie in rcr1 read rcr1 and check cf write 0 to cie in rcr1 carry flag = 1? no yes clear the carry flag disable the carry interrupt read counter register write 1 to cie in rcr1, and write 0 to cf in rcr1 note: set af in rcr1 to 1 so that alarm flag is not cleared. interrupt generated? no yes enable the carry interrupt clear the carry flag disable the carry interrupt read counter register to read the time without using interrupts (b) to use interrupts (a) figure 13.3 reading the time
rev. 4.00, 03/04, page 343 of 660 13.4.4 alarm function figure 13.4 shows how to use the alarm function. alarms can be generated using seconds, minutes, hours, day of the week, date, month, or any combination of these. set the enb bit (bit 7) in the register on which the alarm is placed to 1, and then set the alarm time in the lower bits. clear the enb bit in the register on which the alarm is placed to 0. when the clock and alarm times match, 1 is set in the af bit (bit 0) in rcr1. alarm detection can be checked by reading this bit, but normally it is done by interrupt. if 1 is placed in the aie bit (bit 3) in rcr1, an interrupt is generated when an alarm occurs. disable interrupt to prevent errorneous interruption (aie bit in rcr1 is cleared). then write 1. clock running set alarm time set whether to use alarm interrupt always reset, since the flag may have been set while the alarm time was being set (af bit in rcr1 is cleared). clear alarm flag monitor alarm time (wait for interrupt or check alarm flag) figure 13.4 using the alarm function
rev. 4.00, 03/04, page 344 of 660 13.4.5 crystal oscillator circuit crystal oscillator circuit constants (recommended values) are shown in table 13.2, and the rtc crystal oscillator circuit in figure 13.5. table 13.2 recommended oscillator circuit constants (recommended values) f osc c in c out 32.768 khz 10 to 22 pf 10 to 22 pf sh7706 extal2 xtal2 xtal c in c out r f r d notes: 1. select either the c in or c out side for frequency adjustment variable capacitor according to requirements such as frequency range, degree of stability, etc. 2. built-in resistance value r f (typ value) = 10 m ? , r d (typ value) = 400 k ? 3. c in and c out values include floating capacitance due to the wiring. take care when using a ground plane. 4. the crystal oscillation settling time depends on the mounted circuit constants, floating capacitance, etc., and should be decided after consultation with the crystal resonator manufacturer. 5. place the crystal resonator and load capacitors c in and c out as close as possible to the chip. (correct oscillation may not be possible if there is externally induced noise in the extal2 and xtal2 pins.) 6. ensure that the crystal resonator connection pin (extal2, xtal2) wiring is routed as far away as possible from other power lines (except gnd) and signal lines. figure 13.5 example of crystal oscillator circuit connection
rev. 4.00, 03/04, page 345 of 660 13.5 usage note 13.5.1 register writing during rtc count the following rtc registers cannot be written to during an rtc count (while bit 0 = 1 in rcr2). rseccnt, rmincnt, rhrcnt, rdaycnt, rwkcnt, rmoncnt, ryrcnt the rtc count must be halted before writing to any of the above registers. 13.5.2 use of realtime clock (rtc) periodic interrupts the method of using the periodic interrupt function is shown in figure 13.6. a periodic interrupt can be generated periodically at the interval set by the periodic interrupt enable flag (pes0 to pes2) in rcr2. when the time set by the pes0 to pes2 has elapsed, the pef is set to 1. the pef is cleared to 0 upon periodic interrupt generation when the periodic interrupt enable flag (pes0 to pes2) is set. periodic interrupt generation can be confirmed by reading this bit, but normally the interrupt function is used. set pes0 to pes2, and clear pef to 0, in rcr2 clear pef to 0 set pes, clear pef elapse of time set by pes clear pef figure 13.6 using periodic interrupt function
rev. 4.00, 03/04, page 346 of 660 13.5.3 timing for setting adj bit in rcr2 after the adj bit in rcr2 of the rtc is set to 1, it takes a maximum of approximately 91.6 s (when a 32.768-khz crystal resonator is connected to the extal2 pin) for the setting to affect the value read from the second counter (rseccnt). if the result of 30-second adjustment by the adj bit in rcr2 needs to be reflected in the value read from the second counter, be sure to read from the second counter only after at least 91.6 s (approximately) has passed after the adj bit has been set to 1. note that 30-second adjustment is actually performed for the second counter at the time the adj bit is set to 1, so this delay does not affect the rtc operation itself.
rev. 4.00, 03/04, page 347 of 660 section 14 serial communication interface (sci) this lsi has an on-chip serial communication interface (sci) that supports both asynchronous and clock synchronous serial communication. it also has a multiprocessor communication function for serial communication among two or more processors. a block diagram of sci is shown in figure 14.1, and the i/o ports are shown in figures 14.2 to 14.4. 14.1 feature the sci has the following features. ? selectable from asynchronous or clock synchronous as the serial communications mode ? asynchronous mode: ? serial data communications are synched by start-stop in character units. the sci can communicate with a universal asynchronous receiver/transmitter (uart), an asynchronous communication interface adapter (acia), or any other communications chip that employs a standard asynchronous serial system. it can also communicate with two or more other processors using the multiprocessor communication function. there are 12 selectable serial data communication formats. ? data length: seven or eight bits ? stop bit length: one or two bits ? parity: even, odd, or none ? multiprocessor bit: 1 or 0 ? receive error detection: parity, overrun, and framing errors ? break detection: by reading the rxd0 pin level directly from the port serial communication port data register (scpdr) when a framing error occurs ? clock synchronous mode: ? serial data communication is synchronized with a clock signal. the sci can communicate with other chips having a clock synchronous communication function. one serial data communication format is available. ? data length: eight bits ? receive error detection: overrun errors ? full duplex communication the transmitting and receiving sections are independent, so the sci can transmit and receive simultaneously. both sections use double buffering, so continuous data transfer is possible in both the transmit and receive directions. ? on-chip baud rate generator with selectable bit rates ? internal or external transmit/receive clock source from either baud rate generator (internal) or sck0 pin (external)
rev. 4.00, 03/04, page 348 of 660 ? four types of interrupts transmit-data-empty, transmit-end, receive-data-full, and receive-error interrupts are requested independently. ? saving power when the sci is not in use, it can be stopped by halting the clock supply for the saving power. figure 14.1 shows a sci block diagram. rxd0 txd0 sck0 sci scbrr scssr scscr sctdr sctsr scrdr scrsr scsmr scpdr scpcr parity generation parity check clock external clock module data bus internal data bus p p /4 p /16 p /64 txi tei rxi eri bus interface baud rate generator transmit/ receive control scrsr: scrdr: sctsr: sctdr: scsmr: receive shift register receive data register transmit shift register transmit data register serial mode register scscr: scssr: scbrr: scpdr: scpcr: serial control register serial status register bit rate register sc port data register sc port control register legend figure 14.1 sci block diagram
rev. 4.00, 03/04, page 349 of 660 internal data bus output enable clock input enable sci serial clock output serial clock input r scp1md0 pcrw reset c q q d r scp1md1 pcrw reset c d r scp1dt1 pdrw reset scpt[1]/sck0 c d pdrw: scpdr write pdrr: pcrw: scpdr read scpcr write pdrr * note: * when reading the sck0 pin, clear the c/ bit in scsmr and the cke1 and cke0 bits in scscr to 0, and set the scp1md1 bit in scpcr to 1. legend figure 14.2 scpt[1]/sck0 pin
rev. 4.00, 03/04, page 350 of 660 internal data bus output enable sci serial transmission output q r scp0dt1 pdrw reset scpt[0]/txd0 c d r scp0md0 pcrw reset c q d r scp0md1 pcrw reset c d legend pcrw: pdrw: scpcr write scpdr write figure 14.3 scpt[0]/txd0 pin sci serial receive data internal data bus pdrr * scpt[0]/rxd0 note: * when reading the rxd0 pin, set the re bit in scscr to 1. legend pdrr: pdr read figure 14.4 scpt[0]/rxd0 pin
rev. 4.00, 03/04, page 351 of 660 14.2 input/output pin the sci has the serial pins summarized in table 14.1. table 14.1 sci pins pin name abbreviation i/o function serial clock pin sck0 i/o clock i/o receive data pin rxd0 input receive data input transmit data pin txd0 output transmit data output note: they are made to function as serial pins by performing sci operation settings with the te, re, ckei, and ckeo bits in scscr and the c/ a bit in scsmr. break state transmission and detection can be performed by means of the sci's scpdr. 14.3 register description the sci has the registers listed below. these registers select the communication mode (asynchronous or clock synchronous), specify the data format and bit rate, and control the transmitter and receiver sections. sci has the registers listed below. refer to section 23, list of registers, for more details of the addresses and access sizes. ? serial mode register (scsmr) ? bit rate register (scbrr) ? serial control register (scscr) ? transmit data register (sctdr) ? serial status register (scssr) ? receive data register (scrdr) ? sc port control register (scpcr) ? sc port data register (scpdr)
rev. 4.00, 03/04, page 352 of 660 14.3.1 receive shift register (scrsr) the receive shift register (scrsr) is an 8-bit register that receives serial data. data input at the rxd pin is loaded into the scrsr in the order received, lsb (bit 0) first, converting the data to parallel form. when one byte has been received, it is automatically transferred to the scrdr. the cpu cannot read or write the scrsr directly. 14.3.2 receive data register (scrdr) the receive data register (scrdr) is an 8-bit register that stores serial receive data. the sci completes the reception of one byte of serial data by moving the received data from the scrsr into the scrdr for storage. the scrsr is then ready to receive the next data. this double buffering allows the sci to receive data continuously. the cpu can read but not write the scrdr. the scrdr is initialized to h'00 by a reset or in standby or module standby modes. 14.3.3 transmit shift register (sctsr) the transmit shift register (sctsr) transmits serial data. the sci loads transmit data from the sctdr into the sctsr, then transmits the data serially to the txd0 pin, lsb (bit 0) first. after transmitting one-byte data, the sci automatically loads the next transmit data from the sctdr into the sctsr and starts transmitting again. if the tdre bit of the scssr is 1, however, the sci does not load the sctdr contents into the sctsr. the cpu cannot read or write the sctsr directly. 14.3.4 transmit data register (sctdr) the transmit data register (sctdr) is an eight-bit register that stores data for serial transmission. when the sci detects that the sctsr is empty, it moves transmit data written in the sctdr into the sctsr and starts serial transmission. continuous serial transmission is possible by writing the next transmit data in the sctdr during serial transmission from the sctsr. the cpu can always read and write the sctdr. the sctdr is initialized to h'ff by a reset or in standby and module standby modes.
rev. 4.00, 03/04, page 353 of 660 14.3.5 serial mode register (scsmr) the serial mode register (scsmr) is an eight-bit register that specifies the sci serial communication format and selects the clock source for the baud rate generator. the cpu can always read and write the scsmr. bit bit name initial value r/w description 7c/ a 0 r/w communication mode selects whether the sci operates in the asynchronous or clock synchronous mode. 0: asynchronous mode 1: clock synchronous mode 6 chr 0 r/w character length selects seven-bit or eight-bit data length in the asynchronous mode. in the clock synchronous mode, the data length is always eight bits, regardless of the chr setting. 0: eight-bit data 1: seven-bit data note: when seven-bit data is selected, the msb (bit 7) in the sctdr is not transmitted. 5 pe 0 r/w parity enable selects whether to add a parity bit to the transmit data or to check the parity of receive data in asynchronous mode. in the clock synchronous mode, a parity bit is neither added nor checked, regardless of the pe setting. 0: parity bit not added and not checked 1: parity bit added and checked note:whenpeissetto1,anevenoroddparity bit is added to transmit data, depending on the parity mode (o/e) setting. receive data parity is checked according to the even/odd (o/e) mode setting.
rev. 4.00, 03/04, page 354 of 660 bit bit name initial value r/w description 4o/ e 0 r/w parity mode selects even or odd parity when parity bits are added and checked. the o/ e setting is available only when the pe is set to 1 to enable parity addition and check in asynchronous mode. the o/ e setting is ignored in the clock synchronous mode, or in the asynchronous mode when parity addition and check is disabled. 0: even parity note: if even parity is selected, the parity bit is added to transmit data to make an even number of 1s in the transmitted character and parity bit. receive data is checked to see if it has an even number of 1s in the received character and parity bit combined. 1: odd parity note: if odd parity is selected, the parity bit is added to transmit data to make an odd number of 1s in the transmitted character and parity bit. receive data is checked to see if it has an odd number of 1s in the received character and parity bit combined. 3 stop 0 r/w stop bit length selects one or two bits as the stop bit length in the asynchronous mode. this setting is used only in the asynchronous mode. it is ignored in the clock synchronous mode because no stop bits are added. 0: one stop bit note: in transmitting, a single bit of 1 is added at the end of each transmitted character. 1:twostopbits note: in transmitting, two bits of 1 are added at the end of each transmitted character. in receiving, only the first stop bit is checked, regardless of the stop bit setting. if the second stop bit is 1, it is treated as a stop bit, but if the second stop bit is 0, it is treated as the start bit of the next incoming character.
rev. 4.00, 03/04, page 355 of 660 bit bit name initial value r/w description 2 mp 0 r/w multiprocessor mode selects multiprocessor format. when multiprocessor format is selected, settings of the pe and o/ e bits are ignored. the mp setting is used available in the asynchronous mode; it is ignored in the clock synchronous mode. for the multiprocessor communication function, see section 14.4.2, multiprocessor communication. 0: multiprocessor function disabled 1: multiprocessor format selected 1 0 cks1 cks0 0 0 r/w r/w clock select 1 and 0 these bits select the internal clock source of the on-chip baud rate generator. four clock sources are available. p ,p /4, p /16 and p /64. for further information on the clock source, bit rate register settings, and baud rate, see section 14.3.10, bit rate register (scbrr). 00: p 01: p /4 10: p /16 11: p /64 note: p : peripheral clock 14.3.6 serial control register (scscr) the serial control register (scscr) operates the sci transmitter/receiver, selects the serial clock output in the asynchronous mode, enables/disables interrupt requests, and selects the transmit/receive clock source. the cpu can always read and write the scscr. bit bit name initial value r/w description 7 ties 0 r/w transmit interrupt enable enables or disables the txi request when the serial transmit data is transferred from sctdr to sctcr and the tdre in scssr is set to 1. 0: transmit-data-empty interrupt request (txi) is disabled note: the txi interrupt request can be cleared by reading tdre after it has been set to 1, then clearing tdre to 0, or by clearing tie to 0. 1: transmit-data-empty interrupt request (txi) is enabled
rev. 4.00, 03/04, page 356 of 660 bit bit name initial value r/w description 6 rie 0 r/w receive interrupt enable enables or disables the receive-data-full interrupt (rxi) request when the serial receive data is transferred from scrsr to scrdr and the receive data register full bit (rdrf) in scssr is set to 1. it also enables or disables receive-error interrupt (eri) requests. 0: receive-data-full interrupt (rxi) and receive- error interrupt (eri) requests are disabled note: rxi and eri interrupt requests can be cleared by reading 1 from the rdrf flag or error flag (fer, per, or orer) then clearing theflagto0,orbyclearingrieto0. 1: receive-data-full interrupt (rxi) and receive- error interrupt (eri) requests are enabled 5 te 0 r/w transmit enable enables or disables the sci serial transmitter. 0: transmission disabled note: the tdre in scssr is fixed to 1. 1: transmission enabled note: serial transmission starts when tdre bit in scssr is cleared to 0 after writing of transmit data into the sctdr. specify the transmit format to the scsmr before setting te to 1. 4 re 0 r/w receive enable enables or disables the sci serial receiver. 0: reception disabled note: clearing re to 0 does not affect the receive flags (rdrf, fer, per, orer). these flags retain their previous values. 1: reception enabled note: serial reception starts when a start bit is detected in the asynchronous mode, or synchronous clock input is detected in the clock synchronous mode. specify the receive format to the scsmr before setting re to 1.
rev. 4.00, 03/04, page 357 of 660 bit bit name initial value r/w description 3 mpie 0 r/w multiprocessor interrupt enable enables or disables multiprocessor interrupts. the mpie setting is used only in the asynchronous mode, and only if the multiprocessor mode bit (mp) in the serial mode register (scsmr) is set to 1 during reception. the mpie setting is ignored in the clock synchronous mode or when the mp bit is cleared to 0. 0: multiprocessor interrupts are disabled (normal receive operation) [clearing conditions] 1. mpie is cleared to 0. 2. mpb=1isinreceiveddata. 1: multiprocessor interrupts are enabled receive-data-full interrupt requests (rxi), receive-error interrupt requests (eri), and setting of the rdrf, fer, and orer status flags in the serial status register (scssr) are disabled until data with a multiprocessor bit of 1 is received. note: the sci does not transfer receive data from the scrsr to the scrdr, does not detect receive errors, and does not set the rdrf, fer, and orer flags in the serial status register (scssr). when it receives data that includes mpb = 1, the scssr's mpb flag is set to 1, and the sci automatically clears mpie to 0, generates rxi and eri interrupts (if the tie and rie bits in the scscr are set to 1), and allows the fer and orer bits to be set. 2 teie 0 r/w transmit-end interrupt enable enables or disables the transmit-end interrupt (tei) requested if sctdr does not contain new transmit data when the msb is transmitted. 0: transmit-end interrupt (tei) requests are disabled * 1: transmit-end interrupt (tei) requests are enabled * note: * the tei request can be cleared by reading the tdre bit in scssr after it has been set to 1, then clearing tdre to 0 and clearing the tend bit to 0, or by clearing the teie bit to 0.
rev. 4.00, 03/04, page 358 of 660 bit bit name initial value r/w description 1 0 cke1 cke0 0 0 r/w r/w clock enable 1 and 0 these bits select the sci clock source and enable or disable clock output from the sck pin. depending on the combination of cke1 and cke0, the sck pin can be used for serial clock output or serial clock input. the cke0 setting is valid only in the asynchronous mode, and only when the sci is internally clock (cke1 = 0). the cke0 setting is ignored in the clock synchronous mode, or when an external clock source is selected (cke1 = 1). before selecting the sci operating mode in the serial mode register (scsmr), set cke1 and cke0. for further details on selection of the sci clock source, see table 14.9. ? asynchronous mode 00: internal clock; sck0 pin is used for input pin (input signal is ignored). * 1 01: internal clock; sck0 pin is used for clock output. * 2 01: external clock; sck0 pin is used for clock input. * 3 11: external clock; sck0 pin is used for clock input. * 3 ? clock synchronous mode 00: internal clock; sck0 pin is used for synchronous clock output. * 1 01: internal clock; sck0 pin is used for synchronous clock output. 01: external clock; sck0 pin is used for synchronous clock input. 11: external clock; sck0 pin is used for synchronous clock input. notes: 1. initial value 2. the output clock frequency is the same as the bit rate. 3. the input clock frequency is 16 times the bit rate.
rev. 4.00, 03/04, page 359 of 660 14.3.7 serial status register (scssr) the serial status register (scssr) is an 8-bit register containing multiprocessor bit values, and status flags that indicate sci operating state. the cpu can always read and write the scssr, but cannot write 1 in the status flags (tdre, rdrf, orer, per, and fer). these flags can be cleared to 0 only if they have first been read (after being set to 1). bits 2 (tend) and 1 (mpb) are read-only bits that cannot be written. bit bit name initial value r/w description 7 tdre 1 r/(w) * transmit data register empty indicates that the sci has loaded transmit data from the sctdr into the sctsr and new serial transmit data can be written in the sctdr. 0: sctdr contains valid transmit data [clearing condition] tdre is read as 1, then written to with 0. 1: sctdr does not contain valid transmit data [setting conditions] 1. the chip is reset or enters standby mode. 2. te bit in the serial control register (scscr) is 0. 3. sctdr contents are loaded into sctsr, sonewdatacanbewritteninsctdr. 6 rdrf 0 r/(w) * receivedataregisterfull indicates that scrdr contains received data. 0: scrdr does not contain valid received data [clearing conditions] 1. the chip is reset or enters standby mode. 2. rdrf is read as 1, then written to with 0. 1: scrdr contains valid received data [setting condition] serial data is received normally and transferred from scrsr to scrdr. note: the scrdr and rdrf are not affected by detection of receive errors or by clearing of the re bit to 0 in the serial control register. they retain their previous contents. if rdrf is still set to 1 when reception of the next data ends, an overrun error (orer) occurs and the received data is lost.
rev. 4.00, 03/04, page 360 of 660 bit bit name initial value r/w description 5 orer 0 r/(w) * overrun error indicates that data reception aborted due to an overrun error. 0: receiving is in progress or has ended normally * 1 [clearing conditions] 1. the chip is reset or enters standby mode. 2. orer is read as 1, then written to with 0. 1: a receive overrun error occurred * 2 [setting condition] reception of the next serial data has ended when rdrf is set to 1. notes: 1. clearing the re bit to 0 in the serial control register does not affect the orer bit, which retains its previous value. 2. scrdr continues to hold the data received before the overrun error, so subsequent receive data is lost. serial receiving cannot continue while orer is set to 1. in the clock synchronous mode, serial transmitting is also disabled.
rev. 4.00, 03/04, page 361 of 660 bit bit name initial value r/w description 4fer0 r/(w) * framing error indicates that data reception aborted due to a framing error in the asynchronous mode. 0: receiving is in progress or has ended normally [clearing conditions] 1. the chip is reset or enters standby mode. 2. ferisreadas1,thenwrittentowith0. note: clearing the re bit to 0 in the serial control register does not affect the fer bit, which retains its previous value. 1: a receive framing error occurred [setting condition] when the sci has completed receiving, the stop bit at the end of receive data is checked and found to be 0. note: when the stop bit length is two bits, only the first bit is checked. the second stop bit is not checked. when a framing error occurs, the sci transfers the receive data into the scrdr but does not set rdrf. serial receiving cannot continue while fer is set to 1. in the clock synchronous mode, serial transmitting is also disabled.
rev. 4.00, 03/04, page 362 of 660 bit bit name initial value r/w description 3 per 0 r/(w) * parity error indicates that data reception (with parity) aborted due to a parity error in the asynchronous mode. 0: receiving is in progress or has ended normally [clearing conditions] 1. the chip is reset or enters standby mode. 2. per is read as 1, then written to with 0. note: clearing the re bit to 0 in the scscr does not affect the per bit, which retains its previous value. 1: a receive parity error occurred [setting condition] the number of 1s in receive data, including the parity bit, does not match the even or odd parity setting of the parity mode bit (o/ e )inscsmr. when a parity error occurs, the sci transfers the receive data into the scrdr but does not set rdrf. serial receiving cannot continue while per is set to 1. in the clock synchronous mode, serial transmitting also cannot continue. 2 tend 1 r transmit end indicates that when the last bit of a serial character was transmitted, the sctdr did not contain valid data, so transmission has ended. tend is a read- only bit and cannot be written. [clearing condition] tdre is read as 1, then written to with 0. [setting conditions] 1. the chip is reset or enters standby mode. 2. te bit in scscr is 0. 3. tdre is 1 when the last bit of a one-byte serial character is transmitted.
rev. 4.00, 03/04, page 363 of 660 bit bit name initial value r/w description 1 mpb 0 r multiprocessor bit stores the value of the multiprocessor bit in receive data when a multiprocessor format is selected for receiving in the asynchronous mode. the mpb is a read-only bit and cannot be written. 0: multiprocessor bit value in receive data is 0 if re is cleared to 0 when a multiprocessor format is selected, the mpb retains its previous value. 1: multiprocessor bit value in receive data is 1 note: clearing the re bit to 0 in the maltiprocessor format, which retain its previous value. 0 mpbt 0 r/w multiprocessor bit transfer stores the value of the multiprocessor bit added to transmit data when a multiprocessor format is selected for transmitting in the asynchronous mode. the mpbt setting is ignored in the clock synchronous mode, when a multiprocessor format is not selected, or when the sci is not transmitting. 0: multiprocessor bit value in transmit data is 0 1: multiprocessor bit value in transmit data is 1 note: * the only value that can be written is a 0 to clear the flag.
rev. 4.00, 03/04, page 364 of 660 14.3.8 sc port control register (scpcr) the sc port control register (scpcr) controls the direction of i/o signals on the sci and scif pins. scpcr settings are used to perform i/o direction control, enabling data written in scpdr to be output to the txd0 pin, data read from the rxd0 pin to be input, and the breaking of serial transmission/reception. it is also possible to read data on and write output data to the sck0 pin. the i/o controls on the sci and scif pins are performed using bits 3 to 0, and bits 11 to 4 in scpcr, respectively. bit bit name initial value r/w description 15 to 12 ? all 0 r reserved these bits are always read as 0; only 0 should be written here. 11 10 9 8 7 6 5 4 scp5md1 scp5md0 scp4md1 scp4md0 scp3md1 scp3md0 scp2md1 scp2md0 1 0 1 0 1 0 1 0 r/w r/w r/w r/w r/w r/w r/w r/w see section 17.1.10, sc port control register (scpcr). 3 2 scp1md1 scp1md0 1 0 r/w r/w serial clock port i/o these bits specify serial port sck0 pin i/o. when the sck0 pin is actually used as a port i/o pin, clear the c/ a bit of scsmr and bits cke1 and cke0 of scscr to 0. 00: scp1dt bit value is not output to sck0 pin. 01: scp1dt bit value is output to sck0 pin. 10: sck0 pin value is read from scp1dt bit. 11: sck0 pin value is read from scp1dt bit. 1 0 scp0md1 scp0md0 0 0 r/w r/w serial port break i/o these bits specify the serial port txd0 pin output condition. when the txd0 pin is actually used as a port output pin and outputs the value set with the scp0dt bit, clear the te bit of scscr to 0. 00: scp0dt bit value is not output to txd0 pin. 01: scp0dt bit value is output to txd0 pin.
rev. 4.00, 03/04, page 365 of 660 14.3.9 sc port data register (scpdr) the sc port data register (scpdr) controls data on the sci and scif pins. the data controls on thesciandscifpinsareperformedusingbits1and0,andbits5and2inscpdr,respectively. bit bit name initial value r/w description 7, 6 ?? r reserved these bits are always read as 0; only 0 should be written here. 5 4 3 2 scp5dt scp4dt scp3dt scp2dt ? 0 0 0 r r/w r/w r/w see section 18.10.2, sc port data register (scpdr). 1 scp1dt 0 r/w serial clock port data specifies the serial port sck0 pin i/o data. input or output is specified by the scp1md0 and scp1md1 bits. in output mode, the value of the scp1dt bit is output to the sck0 pin. 0: i/o data is low (0). 1: i/o data is high (1). 0 scp0dt 0 r/w serial port break data specifies the serial port rxd0 pin input data and txd0 pin output data. the txd0 pin output condition is specified by the scp0md0 and scp0md1 bits. when the txd0 pin is set to output mode, the value of the scp0dt bit is output to the txd0 pin. the rxd0 pin value is read from the scp0dt bit regardless of the values of the scp0md0 and scp0md1 bits, if re in the scscr is set to 1. the initial value of this bit after a power-on reset is undefined. 0: i/o data is low (0). 1: i/o data is high (1).
rev. 4.00, 03/04, page 366 of 660 14.3.10 bit rate register (scbrr) the bit rate register (scbrr) is an eight-bit register that, together with the baud rate generator clock source selected by the cks1 and cks0 bits in scsmr, determines the serial transmit/receive bit rate. the cpu can always read and write the scbrr. the scbrr is initialized to h'ff by a reset or in module standby or standby mode. each channel has independent baud rate generator control, so different values can be set in two channels. the scbrr setting is calculated as follows: asynchronous mode: n = [p /(64 2 2n ? 1 b)] 10 6 ?1 clock synchronous mode: n = [p /(8 2 2n ? 1 b)] 10 6 ?1 b: bit rate (bit/s) n: scbrr setting for baud rate generator (0 n 255) p : operating frequency for peripheral modules (mhz) n: baud rate generator clock source (n = 0, 1, 2, 3) (for the clock sources and values of n, see table 14.2.) table 14.2 scsmr settings scsmr settings n clock source cks1 cks0 0p 00 1p /4 0 1 2p /16 1 0 3p /64 1 1 find the bit rate error for the asynchronous mode by the following formula: error (%) = (n + 1) b 64 2 p f 10 ? 1 100 2n-1 6
rev. 4.00, 03/04, page 367 of 660 table 14.3 lists examples of scbrr settings in the asynchronous mode; table 14.4 lists examples of scbrr settings in the clock synchronous mode. table 14.3 bit rates and scbrr settings in asynchronous mode p (mhz) 7.3728 8 9.8304 bit rate (bits/s) n n error (%) n n error (%) n n error (%) 110 2 130 ?0.07 2 141 0.03 2 174 ?0.26 150 2 95 0.00 2 103 0.16 2 127 0.00 300 1 191 0.00 1 207 0.16 1 255 0.00 600 1 95 0.00 1 103 0.16 1 127 0.00 1200 0 191 0.00 0 207 0.16 0 255 0.00 2400 0 95 0.00 0 103 0.16 0 127 0.00 4800 0 47 0.00 0 51 0.16 0 63 0.00 9600 0 23 0.00 0 25 0.16 0 31 0.00 19200 0 11 0.00 0 12 0.16 0 15 0.00 31250 0 6 5.33 0 7 0.00 0 9 ?1.70 38400 0 5 0.00 0 6 ?6.99 0 7 0.00 p (mhz) 10 12 12.288 bit rate (bits/s) n n error (%) n n error (%) n n error (%) 110 2 177 ?0.25 2 212 0.03 2 217 0.08 150 2 129 0.16 2 155 0.16 2 159 0.00 300 2 64 0.16 2 77 0.16 2 79 0.00 600 1 129 0.16 1 155 0.16 1 159 0.00 1200 1 64 0.16 1 77 0.16 1 79 0.00 2400 0 129 0.16 0 155 0.16 0 159 0.00 4800 0 64 0.16 0 77 0.16 0 79 0.00 9600 0 32 ?1.36 0 38 0.16 0 39 0.00 19200 0 15 1.73 0 19 0.16 0 19 0.00 31250 0 9 0.00 0 11 0.00 0 11 2.40 38400 0 7 1.73 0 9 ?2.34 0 9 0.00
rev. 4.00, 03/04, page 368 of 660 p (mhz) 14.7456 16 19.6608 20 bit rate (bits/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 3 64 0.70 3 70 0.03 3 86 0.31 3 88 ?0.25 150 2 191 0.00 2 207 0.16 2 255 0.00 3 64 0.16 300 2 95 0.00 2 103 0.16 2 127 0.00 2 129 0.16 600 1 191 0.00 1 207 0.16 1 255 0.00 2 64 0.16 1200 1 95 0.00 1 103 0.16 1 127 0.00 1 129 0.16 2400 0 191 0.00 0 207 0.16 0 255 0.00 1 64 0.16 4800 0 95 0.00 0 103 0.16 0 127 0.00 0 129 0.16 9600 0 47 0.00 0 51 0.16 0 63 0.00 0 64 0.16 19200 0 23 0.00 0 25 0.16 0 31 0.00 0 32 ?1.36 31250 0 14 ?1.70 0 15 0.00 0 19 ?1.70 0 19 0.00 38400 0 11 0.00 0 12 0.16 0 15 0.00 0 15 1.73 p (mhz) 24 24.576 28.7 30 bit rate (bits/s) n n error (%) n n error (%) n n error (%) n n error (%) 110 3 106 ?0.44 3 108 0.08 3 126 0.31 3 132 0.13 150 3 77 0.16 3 79 0.00 3 92 0.46 3 97 ?0.35 300 2 155 0.16 2 159 0.00 2 186 ?0.08 2 194 0.16 600 2 77 0.16 2 79 0.00 2 92 0.46 2 97 ?0.35 1200 1 155 0.16 1 159 0.00 1 186 ?0.08 1 194 0.16 2400 1 77 0.16 1 79 0.00 1 92 0.46 1 97 ?0.35 4800 0 155 0.16 0 159 0.00 0 186 ?0.08 0 194 0.16 9600 0 77 0.16 0 79 0.00 0 92 0.46 0 97 ?0.35 19200 0 38 0.16 0 39 0.00 0 46 ?0.61 0 48 ?0.35 31250 0 23 0.00 0 24 ?1.70 0 28 ?1.03 0 29 0.00 38400 0 19 ?2.34 0 19 0.00 0 22 1.55 0 23 1.73
rev. 4.00, 03/04, page 369 of 660 p (mhz) 33.34 bit rate (bits/s) n n error (%) 110 3 147 0.00 150 3 108 ?0.43 300 2 216 0.03 600 2 108 ?0.43 1200 1 216 0.03 2400 1 108 ?0.43 4800 0 216 0.03 9600 0 108 ?0.43 19200 0 53 0.49 31250 0 32 1.03 38400 0 26 0.49 table 14.4 bit rates and scbrr settings in clock synchronous mode p (mhz) 8 16 28.7 30 bit rate (bits/s) n n n n n n n n 110 ? ? ? ? ? ? ? ? 250 3 124 3 249 ? ? ? ? 500 2 249 3 124 3 223 3 233 1k 2 124 2 249 3 111 3 116 2.5k 1 199 2 99 2 178 2 187 5k 1 99 1 199 2 89 2 93 10k 0 199 1 99 1 178 1 187 25k 0 79 0 159 1 71 1 74 50k 0 39 0 79 0 143 0 149 100k 0 19 0 39 0 71 0 74 250k 0 7 0 15 ? ? 0 29 500k 0 3 0 7 ? ? 0 14 1m 0103???? 2m 0 0 * 01????
rev. 4.00, 03/04, page 370 of 660 note: settings with an error of 1 % or less are recommended. blank: no setting possible ? : setting possible, but error occurs * : continuous transmit/receive not possible table 14.5 indicates the maximum bit rates in the asynchronous mode when the baud rate generator is used. tables 14.6 and 14.7 list the maximum rates for external clock input. table 14.5 maximum bit rates for various frequencies with baud rate generator (asynchronous mode) settings p (mhz) maximum bit rate (bits/s) n n 8 250000 0 0 9.8304 307200 0 0 12 375000 0 0 14.7456 460800 0 0 16 500000 0 0 19.6608 614400 0 0 20 625000 0 0 24 750000 0 0 24.576 768000 0 0 28.7 896875 0 0 30 937500 0 0
rev. 4.00, 03/04, page 371 of 660 table 14.6 maximum bit rates during external clock input (asynchronous mode) p (mhz) external input clock (mhz) maximum bit rate (bits/s) 8 2.0000 125000 9.8304 2.4576 153600 12 3.0000 187500 14.7456 3.6864 230400 16 4.0000 250000 19.6608 4.9152 307200 20 5.0000 312500 24 6.0000 375000 24.576 6.1440 384000 28.7 7.1750 448436 30 7.5000 468750 table 14.7 maximum bit rates during external clock input (clock synchronous mode) p (mhz) external input clock (mhz) maximum bit rate (bits/s) 8 1.3333 1333333.3 16 2.6667 2666666.7 24 4.0000 4000000.0 28.7 4.7833 4783333.3 30 5.0000 5000000.0
rev. 4.00, 03/04, page 372 of 660 14.4 operation for serial communication, the sci has an asynchronous mode in which characters are synchronized individually, and a clock synchronous mode in which communication is synchronized with clock pulses. asynchronous/clock synchronous mode and the transmission format are selected in scsmr, as listed in table 14.8. the sci clock source is selected by the combination of the c/ a bit in scsmr and the cke1 and cke0 bits in scscr, as listed in table 14.9. asynchronous mode: ? data length is selectable: seven or eight bits. ? parity and multiprocessor bits are selectable. so is the stop bit length (one or two bits). the combination of the preceding selections constitutes the communication format and character length. ? in receiving, it is possible to detect framing errors, parity errors , overrun errors and breaks. ? an internal or external clock can be selected as the sci clock source. ? when an internal clock is selected, the sci operates on the clock of the on-chip baud rate generator, and can output a serial clock signal with a frequency matching the bit rate. ? when an external clock is selected, the external clock input must have a frequency 16 times the bit rate. (the on-chip baud rate generator is not used.) clock synchronous mode: ? the transmission/reception format has a fixed eight-bit data length. ? in receiving, it is possible to detect overrun errors. ? an internal or external clock can be selected as the sci clock source. ? when an internal clock is selected, the sci operates on the clock of the on-chip baud rate generator, and outputs a synchronous clock signal to external devices. ? when an external clock is selected, the sci operates on the input synchronous clock. the on-chip baud rate generator is not used.
rev. 4.00, 03/04, page 373 of 660 table 14.8 serial mode register settings and sci communication formats scsmr settings sci communication format mode bit 7 c/ a a a a bit 6 chr bit 5 pe bit 2 mp bit 3 stop data length parity bit multipro- cessor bit stop bit length 01bit 0 1 not set 2bits 01bit 0 1 1 8-bit set 2bits 01bit 0 1 not set 2bits 01bit asynchronous 1 1 0 1 7-bit set not set 2bits * 01bit 0 * 1 8-bit 2bits * 01bit asynchronous (multiprocessor format) 0 1 * 1 1 7-bit set 2bits clock synchronous 1 **** 8-bit not set not set none note: * don't care table 14.9 scsmr and scscr settings and sci clock source selection scsmr scscr settings sci transmit/receive clock mode bit 7 c/ a a a a bit 1 cke1 bit 0 cke0 clock source sck pin function 0 sci does not use the sck pin 0 1 internal outputs a clock with frequency matching the bit rate 0 asynchronous mode 0 1 1 external inputs a clock with frequency 16 times the bit rate 0 0 1 internal outputs the synchronous clock 0 clock synchronous mode 1 1 1 external inputs the synchronous clock
rev. 4.00, 03/04, page 374 of 660 14.4.1 operation in asynchronous mode in the asynchronous mode, each transmitted or received character begins with a start bit and ends with a stop bit. serial communication is synchronized one character at a time. the transmitting and receiving sections of the sci are independent, so full duplex communication is possible. the transmitter and receiver are both double buffered, so data can be written and read while transmitting and receiving are in progress, enabling continuous transmitting and receiving. figure 14.5 shows the general format of asynchronous serial communication. in asynchronous serial communication, the communication line is normally held in the mark (high) state. the sci monitors the line and starts serial communication when the line goes to the space (low) state, indicating a start bit. one serial character consists of a start bit (low), data (lsb first), parity bit (high or low), and stop bit (high), in that order. when receiving in the asynchronous mode, the sci synchronizes on the falling edge of the start bit. the sci samples each data bit on the eighth pulse of a clock with a frequency 16 times the bit rate. receive data is latched at the center of each bit. 0d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 1 1 0/1 1 1 (lsb) (msb) serial data start bit 1 bit transmit/receive data 7 or 8 bits one unit of communication data (character or frame) example: 8-bit data with parity and two stop bits idling (marking) parity bit stop bit 1 or no bit 1 or 2 bits figure 14.5 data format in asynchronous communication
rev. 4.00, 03/04, page 375 of 660 transmit/receive formats: table 14.10 lists the 11 communication formats that can be selected in the asynchronous mode. the format is selected by settings in the scsmr. table 14.10 serial communication formats (asynchronous mode) scsmr bits serial transmit/receive format and frame length chrpempstop1 23456789 10 11 12 0 0 0 0 start 8-bit data stop 0 0 0 1 start 8-bit data stop stop 0 1 0 0 start 8-bit data p stop 0 1 0 1 start 8-bit data p stop stop 1 0 0 0 start 7-bit data stop 1 0 0 1 start 7-bit data stop stop 1 1 0 0 start 7-bit data p stop 1 1 0 1 start 7-bit data p stop stop 0 ? 1 0 start 8-bit data mpb stop 0 ? 1 1 start 8-bit data mpb stop stop 1 ? 1 0 start 7-bit data mpb stop 1 ? 1 1 start 7-bit data mpb stop stop legend ? : don't care start: start bit stop: stop bit p: parity bit mpb: multiprocessor bit clock: an internal clock generated by the on-chip baud rate generator or an external clock input from the sck0 pin can be selected as the sci transmit/receive clock. the clock source is selected by the c/ a bit in scsmr and bits cke1 and cke0 in the scscr (table 14.9). when an external clock is input on the sck0 pin, it must have a frequency equal to 16 times the desired bit rate. when the sci operates on an internal clock, it can output a clock signal on the sck0 pin. the frequency of this output clock is equal to the bit rate. the phase is aligned as in figure 14.6 so that the rising edge of the clock occurs at the center of each transmit data bit.
rev. 4.00, 03/04, page 376 of 660 0d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 0/1 1 1 1 frame figure 14.6 output clock and serial data timing (asynchronous mode) transmitting and receiving data (sci initialization (asynchronous mode)): before transmitting or receiving, clear the te and re bits to 0 in the serial control register (scscr), then initialize the sci as follows. when changing the operation mode or communication format, always clear the te and re bits to 0 before following the procedure given below. clearing te to 0 sets tdre to 1 and initializes the transmit shift register (sctsr). clearing re to 0, however, does not initialize the rdrf, per, fer, and orer flags or receive data register (scrdr), which retain their previous contents. when an external clock is used, the clock should not be stopped during initialization or subsequent operation. sci operation becomes unreliable if the clock is stopped. figure 14.7 is a sample flowchart for initializing the sci. initialize clear te and re bits in scscr to 0 select transmit/receive format in scsmr set value to scbrr set cke1 and cke0 bits in scscr (te and re bits are 0) wait set te and re bits in scscr to 1 and set rie, teie, and mpie bits has a 1-bit interval elapsed? end no yes select the clock source in the scscr. leave rie, tie, teie, mpie, te, and re cleared to 0. if clock output is selected in asynchronous mode, clock output starts immediately after the setting is made to scscr. select the communication format in the scsmr. write the value corresponding to the bit rate in scbrr unless an external clock is used. wait for at least the interval required to transmit or receive one bit, then set te or re in the scscr to 1. also set rie, tie, teie, and mpie as necessary. setting te or re enables the sci to use the txd0 or rxd0 pin. the initial states are the mark transmit state, and the idle receive state (waiting for a start bit). 1. 2. 3. 4. figure 14.7 sample flowchart for sci initialization
rev. 4.00, 03/04, page 377 of 660 transmitting serial data (asynchronous mode): figure 14.8 shows a sample flowchart for transmitting serial data. serial data transmission should be carried out in the following procedure after setting the sci in a transmission-enabled state. tdre = 1? write transmission data to sctdr and clear tdre bit in scssr to 0 all data transmitted? yes tend = 1? read tend bit in scssr break output? yes clear te bit scscr to 0 end transmission yes read tdre bit in scssr no no yes no no start transmission set scpdr and scpcr sci status check and transmit data write: read the serial status register (scssr), check that the tdre bit is 1, then write transmit data in the sctdr and clear tdre to 0. to continue transmitting serial data: read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in sctdr, then clear tdre to 0. to output a break at the end of serial transmission: set the scpcr and scpdr, then clear the te bit to 0 in scscr. for scpcr and scpdr settings, see14.3.8, sc port control register (scpcr), and 14.3.9, sc port data register (scpdr). 1. 2. 3. figure 14.8 sample flowchart for transmitting serial data
rev. 4.00, 03/04, page 378 of 660 in transmitting serial data, the sci operates as follows: 1. the sci monitors the tdre bit in the scssr. when tdre is cleared to 0, the sci recognizes that the transmit data register (sctdr) contains new data, and loads this data from the sctdr into the sctsr. 2. after loading the data from the sctdr into the sctsr, the sci sets the tdre bit to 1 and starts transmitting. if the transmit-data-empty interrupt enable bit (tie) is set to 1 in the scscr, the sci requests a transmit-data-empty interrupt (txi) at this time. serial transmit data is transmitted in the following order from the txd0 pin: a. start bit: one 0 bit is output. b. transmit data: seven or eight bits of data are output, lsb first. c. parity bit or multiprocessor bit: one parity bit (even or odd parity) or one multiprocessor bit is output. formats in which neither a parity bit nor a multiprocessor bit is output can also be selected. d. stop bit: one or two 1 bits (stop bits) are output. e. marking: output of 1 bits continues until the start bit of the next transmit data. 3. the sci checks the tdre bit when it outputs the stop bit. if tdre is 0, the sci loads new data from the sctdr into the sctsr, outputs the stop bit, then begins serial transmission of the next frame. if tdre is 1, the sci sets the tend bit to 1 in the scssr, outputs the stop bit, then continues output of 1 bits (marking). if the transmit-end interrupt enable bit (teie) in the scscr is set to 1, a transmit-end interrupt (tei) is requested. figure 14.9 shows an example of sci transmit operation in the asynchronous mode. 01 1 1 0/1 0 1 tdre tend parity bit parity bit serial data start bit data stop bit start bit data stop bit idling (marking) txi interrupt request generated example: 8-bit data with parity and one stop bit tei interrupt request generated writes data to sctdr with the txi interrupt processing routine and clear tdre bit to 0 1 frame d 0 d 1 d 7 d 0 d 1 d 7 0/1 txi interrupt request generated figure 14.9 sci transmit operation in asynchronous mode
rev. 4.00, 03/04, page 379 of 660 receiving serial data (asynchronous mode): figure 14.10 shows a sample flowchart for receiving serial data. serial data reception should be carried out in the following procedure after setting the sci in a reception-enabled state. start reception read orer, per, and fer bits in scssr all data received? end reception no yes per = 1, fer = 1, or orer = 1? rdrf = 1? yes yes clear the re bit in scscr to 0 no no read the rdrf bit in scssr error processing read reception data of scrdr and clear rdrf bit in scssr to 0 receive error processing and break detection: if a receive error occurs, read the orer, per and fer bits of the scssr to identify the error. after executing the necessary error processing, clear orer, per and fer all to 0. receiving cannot resume if orer, per or fer remain set to 1. when a framing error occurs, the rxd0 pin can be read to detect the break state. sci status check and receive-data read: read the scssr, check that rdrf is set to 1, then read receive data from the scrdr and clear rdrf to 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. to continue receiving serial data: clear rdrf to 0 before the stop bit of the current frame is received. 1. 2. 3. figure 14.10 sample flowchart for receiving serial data
rev. 4.00, 03/04, page 380 of 660 error processing orer = 1? overrun error processing fer = 1? yes break? no framing error processing per = 1? yes parity error processing clear orer, per, and fer bits in scssr to 0 end no no no yes yes clear re bit in scscr to 0 figure 14.10 sample flowchart for receiving serial data (cont)
rev. 4.00, 03/04, page 381 of 660 in receiving, the sci operates as follows: 1. the sci monitors the communication line. when it detects a start bit (0), the sci synchronizes internally and starts receiving. 2. receive data is stored into the scrsr in order from the lsb to the msb. 3. the parity bit and stop bit are received. after receiving these bits, the sci makes the following checks: a. parity check: the number of 1s in the receive data must match the even or odd parity setting of the o/ e bit in the scsmr. b. stop bit check: the stop bit value must be 1. if there are two stop bits, only the first stop bit is checked. c. status check: rdrf must be 0 so that receive data can be loaded from the scrsr into the scrdr. if these checks all pass, the sci sets rdrf to 1 and stores the received data in the scrdr. if one of the checks fails (receive error), the sci operates as indicated in table 14.11. note: when a receive error flag is set, further receiving is disabled. the rdrf bit is not set to 1. be sure to clear the error flags. 4. after setting rdrf to 1, if the receive-data-full interrupt enable bit (rie) is set to 1 in the scscr, the sci requests a receive-data-full interrupt (rxi). if one of the error flags (orer, per, or fer) is set to 1 and the receive-data-full interrupt enable bit (rie) in the scscr is also set to 1, the sci requests a receive-error interrupt (eri). table 14.11 receive error conditions and sci operation receive error abbreviation condition data transfer overrun error orer receiving of next data ends while rdrf is still set to 1 in scssr receive data not loaded from scrsr into scrdr framing error fer stop bit is 0 receive data loaded from scrsr into scrdr parity error per parity of receive data differs from even/odd parity setting in scsmr receive data loaded from scrsr into scrdr
rev. 4.00, 03/04, page 382 of 660 figure 14.11 shows an example of sci receive operation in the asynchronous mode. rdrf fer eri interrupt request generated by framing error 1 frame example: 8-bit data with parity and one stop bit reads data with the rxi interrupt processing routine and clears rdrf bit to 0 rxi interrupt request generated 01 1 1 0/1 0 1 parity bit parity bit serial data start bit data stop bit start bit data stop bit idling (marking) d 0 d 1 d 7 d 0 d 1 d 7 0/1 figure 14.11 sci receive operation 14.4.2 multiprocessor communication the multiprocessor communication function enables several processors to share a single serial communication line. the processors communicate in the asynchronous mode using a format with an additional multiprocessor bit (multiprocessor format). in multiprocessor communication, each receiving processor is addressed by a unique id. a serial communication cycle consists of an id-sending cycle that identifies the receiving processor, and a data-sending cycle. the multiprocessor bit distinguishes id-sending cycles from data-sending cycles. the transmitting processor starts by sending the id of the receiving processor with which it wants to communicate as data with the multiprocessor bit set to 1. next the transmitting processor sends transmit data with the multiprocessor bit cleared to 0. receiving processors skip incoming data until they receive data with the multiprocessor bit set to 1. when they receive data with the multiprocessor bit set to 1, receiving processors compare the data with their ids. the receiving processor with a matching id continues to receive further incoming data. processors with ids not matching the received data skip further incoming data until they again receive data with the multiprocessor bit set to 1. multiple processors can send and receive data in this way.
rev. 4.00, 03/04, page 383 of 660 figure 14.12 shows an example of communication among processors using the multiprocessor format. receiving station a (id = 01) (id = 02) (id = 03) (id = 04) receiving station b receiving station c serial communications circuit h'01 h'aa (mpb = 0) (mpb = 1) id transmit cycle = specifies receiving station serial data transmitting station receiving station d data transmit cycle = data transmission to receiving station specified by id mpb: multiprocessor bit example: sending data h'aa to receiving processor a figure 14.12 communication among processors using multiprocessor format communication formats: four formats are available. parity-bit settings are ignored when the multiprocessor format is selected. for details see table 14.10. clock: see the description in the asynchronous mode section.
rev. 4.00, 03/04, page 384 of 660 transmitting multiprocessor serial data: figure 14.13 shows a sample flowchart for transmitting multiprocessor serial data. transmission of multiprocessor serial data should be carried out in the following procedure after setting the sci in a transmission-enabled state. tdre = 1? write transmission data to sctdr and set mpbt bit in scssr transmission ended? yes tend = 1? read tend bit in scssr break output? yes set scpdr and scpcr end transmission yes read tdre bit in scssr clear tdre bit to 0 no no yes no no start transmission clear te bit scscr to 0 sci status check and transmit data write: read the scssr, check that the tdre bit is 1, then write transmit data in the sctdr. also set mpbt (multiprocessor bit transfer) to 0 or 1 in scssr. finally, clear tdre to 0. to continue transmitting serial data: read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in sctdr, then clear tdre to 0. to output a break at the end of serial transmission: set the scpdr and scpcr, then clear the te bit to 0 in scscr. for scpcr and scpdr settings, see section 14.3.8, sc port control register (scpcr), and section 14.3.9, sc port data register (scpdr). 1. 2. 3. figure 14.13 sample flowchart for transmitting multiprocessor serial data
rev. 4.00, 03/04, page 385 of 660 in transmitting serial data, the sci operates as follows: 1. the sci monitors the tdre bit in the scssr. when tdre is cleared to 0 the sci recognizes that the sctdr contains new data, and loads this data from the sctdr into the sctsr. 2. after loading the data from the sctdr into the sctsr, the sci sets the tdre bit to 1 and starts transmitting. if the transmit-data-empty interrupt enable bit (tie) in the scscr is set to 1, the sci requests a transmit-data-empty interrupt (txi) at this time. serial transmit data is transmitted in the following order from the txd0 pin: a. start bit: one 0 bit is output. b. transmit data: seven or eight bits are output, lsb first. c. multiprocessor bit: one multiprocessor bit (mpbt value) is output. d. stop bit: one or two 1 bits (stop bits) are output. e. marking: output of 1 bits continues until the start bit of the next transmit data. 3. the sci checks the tdre bit when it outputs the stop bit. if tdre is 0, the sci loads data from the sctdr into the sctsr, outputs the stop bit, then begins serial transmission of the next frame. if tdre is 1, the sci sets the tend bit in the scssr to 1, outputs the stop bit, then continues output of 1 bits in the marking state. if the transmit-end interrupt enable bit (teie) in the scscr is set to 1, a transmit-end interrupt (tei) is requested at this time. figure 14.14 shows sci transmission in the multiprocessor format. tdre tend txi interrupt request generated txi interrupt request generated tei interrupt request generated writes data to tdr with the txi interrupt pro- cessing routine and clears tdre bit to 0 example: 8-bit data with multiprocessor bit and one stop bit 1 frame 01 1 1 0/1 0 1 multi- processor bit serial data start bit data stop bit start bit data stop bit idling (marking) d 0 d 1 d 7 d 0 d 1 d 7 0/1 multi- processor bit figure 14.14 sci multiprocessor transmit operation
rev. 4.00, 03/04, page 386 of 660 receiving multiprocessor serial data: figure 14.15 shows a sample flowchart for receiving multiprocessor serial data. reception of multiprocessor serial data should be carried out in the following procedure after setting the sci in a reception-enabled state. rdrf = 1? fer = 1 or orer = 1? rdrf = 1? all data received? no end reception yes set mpie bit in scscr to 1 read rdrf bit in scssr clear re bit in scscr to 0 no no read orer and fer bits in scssr fer = 1 or orer = 1? read rdrf bit in scssr read receive data in scrdr is id the stations id? yes read orer and fer bits in sscsr no error processing yes yes yes no start reception no yes read receive data in scrdr id receive cycle: set the mpie bit in scscr to 1. sci status check and compare to id reception: read the scssr, check that rdrf is set to 1, then read data from the scrdr and compare with the processor's own id. if the id does not match the receive data, set mpie to 1 again and clear rdrf to 0. if the id matches the receive data, clear rdrf to 0. sci status check and data receiving: read scssr, check that rdrf is set to 1, then read data from the scrdr. receive error processing and break detection: if a receive error occurs, read the orer and fer bits in scssr to identify the error. after executing the necessary error processing, clear both orer and fer to 0. receiving cannot resume if orer or fer remain set to 1. when a framing error occurs, the rxd0 pin can be read to detect the break state. 1. 2. 3. 4. figure 14.15 sample flowchart for receiving multiprocessor serial data
rev. 4.00, 03/04, page 387 of 660 orer = 1? break? yes framing error processing yes error processing overrun error processing yes fer = 1? clear orer and fer bits in scssr to 0 end no no no clear re bit in scscr to 0 figure 14.15 sample flowchart for receiving multiprocessor serial data (cont)
rev. 4.00, 03/04, page 388 of 660 figure 14.16 shows an example of sci receive operation using a multiprocessor format. rdrf mpie rdr value id1 rxi interrupt request (multiprocessor interrupt) generated, mpie = 0 (a) own id does not matches data reads rdr data with the rxi interrupt processing routine and clears rdrf bit to 0 id is not station's id, so mpie bit is set to 1 again no rxi interrupt, generated rdr state is maintained 01 1 1 10 1 stop bit mpb serial data start bit data (id1) data (data 1) start bit mpb stop bit idling (marking) d 0 d 1 d 7 d 0 d 1 d 7 0 rdrf mpie rdr value (b) own id matches data id1 id2 data2 01 1 1 10 1 mpb mpb serial data start bit data (id2) data (data 2) stop bit start bit stop bit idling (marking) d 0 d 1 d 7 d 0 d 1 d 7 0 rxi interrupt request (multiprocessor interrupt) generated, mpie = 0 reads rdr data with the rxi interrupt processing routine and clears rdrf bit to 0 id is that of station, so reception continues unchanged and data is received by the rxi interrupt processing routine mpie bit set to 1 again figure 14.16 example of sci receive operation
rev. 4.00, 03/04, page 389 of 660 14.4.3 clock synchronous operation in the clock synchronous mode, the sci transmits and receives data in synchronization with clock pulses. this mode is suitable for high-speed serial communication. the sci transmitter and receiver are independent, so full-duplex communication is possible while sharing the same clock. the transmitter and receiver are also double buffered, so continuous transmitting or receiving is possible by reading or writing data while transmitting or receiving is in progress. figure 14.17 shows the general format in clock synchronous serial communication. bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 lsb msb synchroni- zation clock serial data don't care don't care * * one unit of communication data (character or frame) note: * high except in continuous transmitting or receiving figure 14.17 data format in clock synchronous communication in clock synchronous serial communication, each data bit is output on the communication line from one falling edge of the serial clock to the next. data are guaranteed valid at the rising edge of the serial clock. in each character, the serial data bits are transmitted in order from the lsb (first) to the msb (last). after output of the msb, the communication line remains in the state of the msb. in the clock synchronous mode, the sci transmits or receives data by synchronizing with the rising edge of the serial clock. communication format: the data length is fixed at eight bits. no parity bit or multiprocessor bit can be added.
rev. 4.00, 03/04, page 390 of 660 clock: an internal clock generated by the on-chip baud rate generator or an external clock input from the sck0 pin can be selected as the sci transmit/receive clock. the clock source is selected by the c/ a bit in scsmr and bits cke1 and cke0 in the scscr. see table 14.9. when the sci operates on an internal clock, it outputs the clock signal at the sck0 pin. eight clock pulses are output per transmitted or received character. when the sci is not transmitting or receiving, the clock signal remains in the high state. when only receiving, the sci receives in 2- character units, so a 16 pulse synchronization clock is output. to receive in 1-character units, select an external clock source. transmitting and receiving data (sci initialization (clock synchronous mode)): before transmitting, receiving, or changing the mode or communication format, the software must clear the te and re bits to 0 in scscr, then initialize the sci. clearing te to 0 sets tdre to 1 and initializes the sctsr. clearing re to 0, however, does not initialize the rdrf, per, fer, and orer flags and scrdr, which retain their previous contents. figure 14.18 is a sample flowchart for initializing the sci. initialize clear te and re bits in scscr to 0 has a 1-bit period elapsed? set te and re bits in scscr to 1 and set rie, tie, teie, and mpie bits set transmit/receive format in scsmr yes no set value in scbrr set rie, tie, teie, mpie, cke1, and cke0 bits in scscr (te and re are 0) end wait select the clock source in the scscr. leave rie, tie, teie, mpie, te and re cleared to 0. select the communication format in the scsmr. write the value corresponding to the bit rate in scbrr unless an external clock is used. wait for at least the interval required to transmit or receive one bit, then set te or re in the scscr to 1. also set rie, tie, teie and mpie. setting te and re allows use of the txd0 and rxd0 pins. 1. 2. 3. 4. figure 14.18 sample flowchart for sci initialization
rev. 4.00, 03/04, page 391 of 660 transmitting serial data (clock synchronous mode): figure 14.19 shows a sample flowchart for transmitting serial data. transmission of serial data should be carried out in the following procedure after setting the sci in a transmission-enabled state. start transmission read tdre bit in scssr all data transmitted? yes no end transmission tdre = 1? write transmission data to sctdr and clear tdre bit in scssr to 0 yes no read tend bit in scssr tend = 1? yes no clear te bit in scscr to 0 sci status check and transmit data write: read the serial status register (scssr), check that the tdre bit is 1, then write transmit data in the transmit data register (sctdr) and clear tdre to 0. to continue transmitting serial data: read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in sctdr, then clear tdre to 0. 1. 2. figure 14.19 sample flowchart for serial transmitting
rev. 4.00, 03/04, page 392 of 660 in transmitting serial data, the sci operates as follows: 1. the sci monitors the tdre bit in the scssr. when tdre is cleared to 0 the sci recognizes that the sctdr contains new data and loads this data from the sctdr into the sctsr. 2. after loading the data from the sctdr into the sctsr, the sci sets the tdre bit to 1 and starts transmitting. if the transmit-data-empty interrupt enable bit (tie) in the scscr is set to 1, the sci requests a transmit-data-empty interrupt (txi) at this time. if clock output mode is selected, the sci outputs eight synchronous clock pulses. if an external clock source is selected, the sci outputs data in synchronization with the input clock. data are output from the txd0 pin in order from the lsb (bit 0) to the msb (bit 7). 3. the sci checks the tdre bit when it outputs the msb (bit 7). if tdre is 0, the sci loads data from the sctdr into the sctsr, then begins serial transmission of the next frame. if tdre is 1, the sci sets the tend bit in the scssr to 1, transmits the msb, then holds the transmit data pin (txd0) in the msb state. if the teie in the scscr is set to 1, a transmit-end interrupt (tei) is requested at this time. 4. after the end of serial transmission, the sck0 pin is held in the high state. figure 14.20 shows an example of sci transmit operation. bit 0 bit 1 bit 7 bit 0 bit 1 bit 6 synchronization clock serial data transfer direction bit 7 writes data to tdr with the txi interrupt processing routine and clears tdre bit to 0 1 frame tdre tend lsb msb txi interrupt request generated txi interrupt request generated tei interrupt request generated figure 14.20 example of sci transmit operation
rev. 4.00, 03/04, page 393 of 660 receiving serial data (clock synchronous mode): figure 14.21 shows a sample flowchart for receiving serial data. serial data reception should be carried out in the procedure described below after setting the sci in a reception-enabled state. when switching from the asynchronous mode to the clock synchronous mode, make sure that orer, per, and fer are cleared to 0. if per or fer is set to 1, the rdrf bit will not be set and both transmitting and receiving will be disabled. read orer bit in scssr all data received? end reception no yes orer = 1? rdrf = 1? yes clear re bit in scscr to 0 no no read rdrf bit in scssr yes error processing read receive data in scrdr and clear rdrf bit in scssr to 0 start reception 1. receive error processing: if a receive error occurs, read the orer bit in scssr to identify the error. after executing the necessary error processing, clear orer to 0. transmitting/receiving cannot resume if orer remains set to 1. 2. sci status check and receive data read: read the scssr, check that rdrf is set to 1, then read receive data from the scrdr and clear rdrf to 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. 3. to continue receiving serial data: read scrdr, and clear rdrf to 0 before the frame msb (bit 7) of the current frame is received. end orer = 1? no clear orer bit in scssr to 0 yes overrun error processing figure 14.21 sample flowchart for serial data receiving
rev. 4.00, 03/04, page 394 of 660 in receiving, the sci operates as follows: 1. the sci synchronizes with serial clock input or output and initializes internally. 2. receive data is stored into the scrsr in order from the lsb to the msb. after receiving the data, the sci checks that rdrf is 0 so that receive data can be loaded from the scrsr into the scrdr. if this check is passed, the sci sets rdrf to 1 and stores the received data in the scrdr. if the check is not passed (receive error), the sci operates as indicated in table 14.11. this state prevents further transmission or reception. while receiving, the rdrf bit is not set to 1. be sure to clear the error flag. 3. after setting rdrf to 1, if the rie is set to 1 in the scscr, the sci requests a receive-data- full interrupt (rxi). if the orer bit is set to 1 and the rie in the scscr is also set to 1, the sci requests a receive-error interrupt (eri). figure 14.22 shows an example of the sci receive operation. bit 7 bit 0 bit 7 bit 0 bit 1 bit 6 synchronization clock serial data transfer direction bit 7 reads data with the rxi interrupt processing routine and clears rdrf bit to 0 1 frame rxi interrupt request generated rxi interrupt request generated eri interrupt request generated by overrun error rdrf orer figure 14.22 example of sci receive operation
rev. 4.00, 03/04, page 395 of 660 transmitting and receiving serial data simultaneously (clock synchronous mode): figure 14.23 shows a sample flowchart for transmitting and receiving serial data simultaneously. simultaneous transmission and reception of serial data should be carried out in the following procedure after setting the sci in a transmission/reception-enabled state. start transmission/reception read tdre bit in scssr all data transmitted/received? end transmission/reception no yes tdre = 1? write transmission data to sctdr and clear tdre bit in scssr to 0 rdrf = 1? no yes yes no read orer bit in scssr error processing orer = 1? no read rdrf bit in scssr yes read receive data of scrdr and clear rdrf bit in scssr to 0 clear te and re bits in scscr to 0 sci status check and transmit data write: read the scssr, check that the tdre bit is 1, then write transmit data in the sctdr and clear tdre to 0. the txi interrupt can also be used to determine if the tdre bit has changed from 0 to 1. receive error processing: if a receive error occurs, read the orer bit in scssr to identify the error. after executing the necessary error processing, clear orer to 0. transmitting/receiving cannot resume if orer remains set to 1. sci status check and receive data read: read the scssr, check that rdrf is set to 1, then read receive data from the scrdr and clear rdrf to 0. the rxi interrupt can also be used to determine if the rdrf bit has changed from 0 to 1. to continue transmitting and receiving serial data: read the rdrf bit and scrdr, and clear rdrf to 0 before the frame msb (bit 7) of the current frame is received. also read the tdre bit to check whether it is safe to write (if it reads 1); if so, write data in sctdr, then clear tdre to 0 before the msb (bit 7) of the current frame is transmitted. note: in switching from transmitting or receiving to simultaneous transmitting and receiving, clear both te and re to 0, then set both te and re to 1. 1. 2. 3. 4. figure 14.23 sample flowchart for serial data transmitting/receiving
rev. 4.00, 03/04, page 396 of 660 14.5 sci interrupt sources the sci has four interrupt sources in each channel: transmit-end (tei), receive-error (eri), receive-data-full (rxi), and transmit-data-empty (txi). table 14.12 lists the interrupt sources and indicates their priority. these interrupts can be enabled and disabled by the tie, rie, and teie bits in scscr. each interrupt request is sent separately to the interrupt controller. txi is requested when the tdre bit in the scssr is set to 1. rxi is requested when the rdrf bit in the scssr is set to 1. eri is requested when the orer, per, or fer bit in the scssr is set to 1. tei is requested when the tend bit in the scssr is set to 1. where the txi interrupt indicates that transmit data writing is enabled, the tei interrupt indicates that the transmit operation is complete. table 14.12 sci interrupt sources interrupt source description priority when reset is cleared eri receive error (orer, per, or fer) high rxi receive data full (rdrf) txi transmit data empty (tdre) tei transmit end (tend) low see section 4, exception processing, for information on the priority order and relationship to non- sci interrupts.
rev. 4.00, 03/04, page 397 of 660 14.6 usage note note the following points when using the sci. sctdr writing to and tdre flag: the tdre bit in scssr is a status flag indicating loading of transmit data from the sctdr into the sctsr. the sci sets tdre to 1 when it transfers data from the sctdr to the sctsr. data can be written to the sctdr regardless of the tdre bit state. if new data is written in the sctdr when tdre is 0, however, the old data stored in the sctdr will be lost because the data has not yet been transferred to the sctsr. before writing transmit data to the sctdr, be sure to check that tdre is set to 1. simultaneous multiple receive errors: table 14.13 indicates the state of the scssr status flags when multiple receive errors occur simultaneously. when an overrun error occurs, the scrsr contents cannot be transferred to the scrdr, so receive data is lost. table 14.13 scssr status flags and transfer of receive data scssr status flags receive error status rdrf orer fer per receive data transfer scrsr scrdr overrun error 1 1 0 0 x framing error 0 0 1 0 o parity error 0 0 0 1 o overrun error + framing error 1 1 1 0 x overrun error + parity error 1 1 0 1 x framing error + parity error 0 0 1 1 o overrun error + framing error + parity error 11 11x notes: x: receive data is not transferred from scrsr to scrdr. o: receive data is transferred from scrsr to scrdr. break detection and processing: break signals can be detected by reading the rxd0 pin directly when a framing error (fer) is detected. in the break state, the input from the rxd0 pin consists of all 0s, so fer is set and the parity error flag (per) may also be set. in the break state, the sci receiver continues to operate, so if the fer bit is cleared to 0, it will be set to 1 again. sending a break signal: the txd0 pin i/o condition and level can be determined by means of the scp0dt bit of the scpdr and bits scp0md0 and scp0md1 of the scpcr. these bits can be used to send breaks. to send a break during serial transmission, clear the scp0dt bit to 0 (designating low level), then clear the te bit to 0 (halting transmission). when the te bit is cleared to 0, the transmitter is initialized regardless of the current transmission state, and 0 is output from the txd0 pin.
rev. 4.00, 03/04, page 398 of 660 tend flag and te bit processing: the tend flag is set to 1 during transmission of the stop bit of the last data. consequently, if the te bit is cleared to 0 immediately after setting of the tend flag has been confirmed, the stop bit will be in the process of transmission and will not be transmitted normally. therefore, the te bit should not be cleared to 0 for at least 0.5 serial clock cycles (or 1.5 cycles if two stop bits are used) after setting of the tend flag setting is confirmed. receive error flags and transmitter operation (clock synchronous mode only): when a receive error flag (orer, per, or fer) is set to 1, the sci will not start transmitting even if tdre is set to 1. be sure to clear the receive error flags to 0 before starting to transmit. note that clearing re to 0 does not clear the receive error flags. receive data sampling timing and receive margin in the asynchronous mode: in the asynchronous mode, the sci operates on a base clock of 16 times the transfer rate frequency. in receiving, the sci synchronizes internally with the falling edge of the start bit, which it samples on the base clock. receive data is latched on the rising edge of the eighth base clock pulse (figure 14.24). 0 1 2 3 4 5 6 7 8 9 10111213 1415 0 1 2 3 4 5 6 7 8 9 10111213 1415 0 1 2 3 4 5 basic clock receive data (rxd0) synchro- nization sampling timing data sampling timing 8 clocks 16 clocks start bit ?7.5 clocks +7.5 clocks d0 d1 figure 14.24 receive data sampling timing in asynchronous mode
rev. 4.00, 03/04, page 399 of 660 the receive margin in the asynchronous mode can therefore be expressed as in equation 1. equation 1: m = 0.5 ? 1 2n d ? 0.5 n ? (l ? 0.5)f ? (1 + f) where: m = receive margin ( % ) n = ratio of clock frequency to bit rate (n = 16) d = clockdutycycle(d = 0to1.0) l = frame length (l = 9to12) f = absolute deviation of clock frequency from equation 1, if f = 0andd = 0.5, the receive margin is 46.875%, as in equation 2. equation 2: m = (0.5 ? 1/(2 16)) 100 % = 46.875 % this is a theoretical value. a reasonable margin to allow in system designs is 20 to 30%. cautions for clock synchronous external clock mode: ? set te = re = 1 only when the external clock sck0 is 1. ? do not set te = re = 1 until at least four clocks after the external clock sck0 has changed from0to1. ? when receiving, rdrf is 1 when re is set to zero 2.5?3.5 clocks after the rising edge of the sck0 input of the d7 bit in rxd0, but it cannot be copied to scrdr. caution for clock synchronous internal clock mode: in the receiving, rdrf become 1 when re is set to 0, 1.5 clocks after the rising edge of the sck0 output of the d7 bit in rxd0, but it cannot be copied to scrdr.
rev. 4.00, 03/04, page 400 of 660
rev. 4.00, 03/04, page 401 of 660 section 15 smart card interface as an added serial communications interface function, the sci supports an ic card (smart card) interface that conforms to the data transfer protocol (asynchronous half-duplex character transmission protocol) of the iso/iec standard 7816-3 for identification of cards. register settings are used to switch between the ordinary serial communication interface and the smart card interface. figure 15.1 is the block diagram of the smart card interface. 15.1 feature the smart card interface has the following features: ? asynchronous mode ? data length: eight bits ? parity bit generation and check ? receive mode error signal detection (parity error) ? transmit mode error signal detection and automatic re-transmission of data ? supports both direct convention and inverse convention ? bit rate can be selected using on-chip baud rate generator. ? three types of interrupts: transmit-data-empty, receive-data-full, and communication-error interrupts are requested independently. rxd0 txd0 sck0 sci scbrr scscr scsmr sctdr sctsr scrdr scrsr scscmr scssr parity generation parity check clock external clock module data bus internal data bus p p /4 p /16 p /64 txi rxi eri bus interface baud rate generator transmit/ receive control scscmr: scrsr: scrdr: sctsr: sctdr: smart card mode register receive shift register receive data register transmit shift register transmit data register scsmr: scscr: scssr: scbrr: serial mode register serial control register serial status register bit rate register legend figure 15.1 smart card interface block diagram
rev. 4.00, 03/04, page 402 of 660 15.2 input/output pin table 15.1 summarizes the smart card interface pins. table 15.1 pin configuration pin name abbreviation i/o function serial clock pin sck0 output clock output receive data pin rxd0 input receive data input transmit data pin txd0 output transmit data output 15.3 register description the smart card interface has the following registers. the scsmr, scbrr, scscr, sctdr, and scrdr registers are the same as those of the sci. so see the register description in section 14, serial communication interface. refer to see section 23, list of registers, for more details of the addresses and access sizes. ? smart card mode register (scscmr) ? serial status register (scssr) ? serial mode register (scsmr) ? bit rate register (scbrr) ? serial control register (scscr) ? transmit data register (sctdr) ? receive data register (scrdr)
rev. 4.00, 03/04, page 403 of 660 15.3.1 smart card mode register (scscmr) the smart card mode register (scscmr) is an 8-bit read/write register that selects smart card interface functions. bit bit name initial value r/w description 7to4 ? ? r reserved an undefined value are read from these bits. 3 sdir 0 r/w smart card data transfer direction selects the serial/parallel conversion format. 0: contents of sctdr are transferred as lsb first, receive data is stored in scrdr as lsb first. 1: contents of sctdr are transferred as msb first, receive data is stored in scrdr as msb first. 2 sinv 0 r/w smart card data inversion specifies whether to invert the logic level of the data. this function is used in combination with bit 3 for transmitting and receiving with an inverse convention card. sinv does not affect the logic level of the parity bit. see section 15.4.4, register settings, for information on how parity is set. 0: contents of sctdr are transferred unchanged, receive data is stored in scrdr unchanged. 1: contents of sctdr are inverted before transfer, receive data is inverted before storage in scrdr. 1? ? rreserved an undefined value is read from this bit. 0 smif 0 r/w smart card interface mode select enables the smart card interface function. 0: smart card interface function disabled 1: smart card interface function enabled
rev. 4.00, 03/04, page 404 of 660 15.3.2 serial status register (scssr) in the smart card interface mode, the function of bit 4 in scssr of the sci is changed as shown blow. relating to this, the setting conditions for bit 2, the tend bit, are also changed. bit bit name initial value r/w description 7 6 5 tdre rdrf orer 1 0 0 r/(w) * r/(w) * r/(w) * transmit data register empty receive register full overrun error these bits have the same function as in the ordinary sci. see section 14, serial communication interface (sci), for more information. 4ers0 r/(w) * error signal status in the smart card interface mode, bit 4 indicates the state of the error signal returned from the receiving side during transmission. the smart card interface cannot detect framing errors. 0: receiving ended normally with no error signal. [clearing conditions] 1. the chip is reset or enters standby mode. 2.ersisreadas1,thenwrittentowith0. 1: an error signal indicating a parity error was transmitted from the receiving side. [setting condition] the error signal sampled is low. note: the ers flag maintains its state even when the te bit in scscr is cleared to 0.
rev. 4.00, 03/04, page 405 of 660 bit bit name initial value r/w description 3 2 1 0 per tend mpb mpbt 0 1 0 0 r/(w) * r r r/w parity error transmission end multiprocessor bit multiprocessor bit transfer these bits have the same function as in the ordinary sci. see section 14, serial communication interface (sci), for more information. the setting conditions for bit 2, the transmit end bit (tend), are changed as follows. 0: transmission is in progress. [clearing condition] tdre is read as 1, then written to with 0. 1: end of transmission. [setting conditions] 1. the chip is reset or enters standby mode. 2. te bit in scscr is 0 and the fer/ers bit is also 0. 3. c/ a bit in scsmr is 0, and tdre = 1 and fer/ers = 0 (normal transmission) 2.5 etu after a one-byte serial character is transmitted. 4. c/ a bit in scsmr is 1, and tdre = 1 and fer/ers = 0 (normal transmission) 1.0 etu after a one-byte serial character is transmitted. note: etu is an abbreviation of elementary time unit, which is the period for the transfer of 1 bit. note: * only 0 can be written, to clear the flag.
rev. 4.00, 03/04, page 406 of 660 15.4 operation 15.4.1 overview the primary functions of the smart card interface are described below. 1. each frame consists of 8-bit data and a parity bit. 2. during transmission, the card leaves a guard time of at least 2 etu (elementary time units: the period for 1 bit to transfer) from the end of the parity bit to the start of the next frame. 3. during reception, the card outputs an error signal low level for 1 etu after 10.5 etu has elapsed from the start bit if a parity error was detected. 4. during transmission, it automatically transmits the same data after allowing at least 2 etu from the time the error signal is sampled. 5. only start-stop type asynchronous communication functions are supported; no synchronous communication functions are available. 15.4.2 pin connections figure 15.2 shows the pin connection diagram for the smart card interface. during communication with an ic card, transmission and reception are both carried out over the same data transfer line, so connect the txd and rxd pins on the chip. pull up the data transfer line to the power supply v cc side with a resistor. when using the clock generated by the smart card interface on an ic card, input the sck pin output to the ic card's clk pin. this connection is not necessary when the internal clock is used on the ic card. use the chip's port output as the reset signal. apart from these pins, the power and ground pin connections are usually also required. note: when the ic card is not connected and both re and te are set to 1, closed communication is possible and self-diagnosis can be performed.
rev. 4.00, 03/04, page 407 of 660 lsi txd0 io clk rst rxd0 sck0 px (port) clock line data line reset line ic card connected device v cc figure 15.2 pin connection diagram for the smart card interface 15.4.3 data format figure 15.3 shows the data format for the smart card interface. in this mode, parity is checked every frame while receiving and error signals sent to the transmitting side whenever an error is detected so that data can be re-transmitted. during transmission, if an error signal is sampled, the same data is re-transmitted. d s d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d p with no parity error transmitting station output d s d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d p d e with parity error transmitting station output receiving station output ds: d0 to d7: dp: de: start bit data bits parity bit error signal figure 15.3 data format for smart card interface
rev. 4.00, 03/04, page 408 of 660 the operating sequence is: 1. the data line is high impedance when not in use and is fixed high with a pull-up resistor. 2. the transmitting side starts one frame of data transmission. the data frame starts with a start bit (ds, low level). the start bit is followed by eight data bits (d0 to d7) and a parity bit (dp). 3. on the smart card interface, the data line returns to high impedance after this. the data line is pulled high with a pull-up resistor. 4. the receiving side checks parity. when the data is received normally with no parity errors, the receiving side then waits to receive the next data. when a parity error occurs, the receiving side outputs an error signal (de, low level) and requests re-transfer of data. the receiving station returns the signal line to high impedance after outputting the error signal for a specified period. the signal line is pulled high with a pull-up resistor. 5. the transmitting side transmits the next frame of data unless it receives an error signal. if it does receive an error signal, it returns to step 2 to re-transmit the erroneous data. 15.4.4 register settings table 15.2 shows the bit map of the registers that the smart card interface uses. bits shown as 1 or 0 must be set to the indicated value. the settings for the other bits are described below. table 15.2 register settings for the smart card interface register address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 scsmr h'fffffe80 c/ a 01o/ e 1 0 cks1 cks0 scbrr h'fffffe82 brr7 brr6 brr5 brr4 brr3 brr2 brr1 brr0 scscr h'fffffe84 tie rie te re 0 0 cke1 cke0 sctdr h'fffffe86 tdr7 tdr6 tdr5 tdr4 tdr3 tdr2 tdr1 tdr0 scssr h'fffffe88 tdre rdrf orer fer/ ers per tend 0 0 scrdr h'fffffe8a rdr7 rdr6 rdr5 rdr4 rdr3 rdr2 rdr1 rdr0 scscmr h'fffffe8c ? ???sdirsinv?smif note: dashes indicate unused bits. 1. setting the serial mode register (scsmr): the c/ a bit selects the set timing of the tend flag, and selects the clock output state with the combination of bits cke1 and cke0 in the scscr. set the o/ e bit to 0 when the ic card uses the direct convention or to 1 when it uses the inverse convention. select the on-chip baud rate generator clock source with the cks1 and cks0 bits (see section 15.4.5, clock). 2. setting the bit rate register (scbrr): set the bit rate. see section 15.4.5, clock, to see how to calculate the set value.
rev. 4.00, 03/04, page 409 of 660 3. setting the serial control register (scscr): the tie, rie, te and re bits function as they do for the ordinary sci. see section 14, serial communication interface (sci), for more information. the cke0 bit specifies the clock output. when no clock is output, set 0; when a clock is output, set 1. 4. setting the smart card mode register (scscmr): the sdir and sinv bits are both set to 0 for ic cards that use the direct convention and both to 1 when the inverse convention is used. the smif bit is set to 1 for the smart card interface. figure 15.4 shows sample waveforms for register settings of the two types of ic cards (direct convention and inverse convention) and their start characters. in the direct convention type, the logical 1 level is state z, the logical 0 level is state a, and communication is lsb first. the start character data is h'3b. the parity bit is even (as specified in the smart card standards), and thus 1. in the inverse convention type, the logical 1 level is state a, the logical 0 level is state z, and communication is msb first. the start character data is h'3f. the parity bit is even (as specified in the smart card standards), and thus 0, which corresponds to state z. only data bits d7 to d0 are inverted by the sinv bit. to invert the parity bit, set the o/ e bit in scsmr to odd parity mode. this applies to both transmission and reception. ds d0 d1 d2 d3 d4 d5 d6 d7 dp a (z) z z a z z z a a z (z) state a. direct convention (sdir, sinv, and o/ are all 0) ds d7 d6 d5 d4 d3 d2 d1 d0 dp a (z) z z a a a a a a z (z) state b. inverse convention (sdir, sinv, and o/ are all 1) figure 15.4 waveform of start character
rev. 4.00, 03/04, page 410 of 660 15.4.5 clock only the internal clock generated by the on-chip baud rate generator can be used as the communication clock in the smart card interface. the bit rate for the clock is set by the scbrr and the cks1 and cks0 bits in the scsmr, and is calculated using the equation below. table 15.4 shows sample bit rates. if clock output is then selected by setting cke0 to 1, a clock with a frequency 372 times the bit rate is output from the sck0 pin. b = 10 6 1488 2 2n?1 (n + 1) p where: n = value set in scbrr (0 n 255) b = bit rate (bit/s) p = peripheral module operating frequency (mhz) n = 0to3(table15.3) table 15.3 relationship of n to cks1 and cks0 n cks1 cks0 00 0 10 1 21 0 31 1 table 15.4 examples of bit rate b (bit/s) for scbrr settings (n = = = = 0) p 0 9600.0 13440.9 14400.0 17473.1 19200.0 21505.4 24193.5 1 4800.0 6720.4 7200.0 8736.6 9600.0 10752.7 12096.8 2 3200.0 4480.3 4800.0 5824.4 6400.0 7168.5 8064.5 note: the bit rate is rounded to two decimal places. calculate the value to be set in the bit rate register (scbrr) from the operating frequency and the bit rate. n is an integer in the range 0 n 255, specifying a smallish error. n = ? 1 1488 ? 1
rev. 4.00, 03/04, page 411 of 660 table 15.5 examples of scbrr settings for bit rate b (bit/s) (n = = = = 0) 0 0.00 1 30.00 1 25.00 1 8.99 1 0.00 1 12.01 2 15.99 table 15.6 maximum bit rates for frequencies (smart card interface mode) p 7.1424 9600 0 0 10.00 13441 0 0 10.7136 14400 0 0 13.00 17473 0 0 14.2848 19200 0 0 16.00 21505 0 0 18.00 24194 0 0 the bit rate error is found as follows: error (%) = ( ? 1) ? 1 table 15.5 shows example settings of scbrr, and table 15.6 shows the maximum bit rate for each frequency. table 15.7 shows the relationship between transmit/receive clock register set values and output states on the smart card interface.
rev. 4.00, 03/04, page 412 of 660 table 15.7 register set values and sck pin register value sck pin setting smif c/ a a a a cke1 cke0 output state 1 0 0 0 port determined by setting of port register scp1md1 and scp1md0 bits 1 * 1 1001 sck0 (serial clock) output state 1 1 0 0 low output low output state 2 * 2 1101 sck0 (serial clock) output state 1 1 1 0 high output high output state 3 * 2 1111 sck0 (serial clock) output state notes: 1. the sck0 output state changes as soon as the cke0 bit is modified. the cke1 bit should be cleared to 0. 2. the clock duty remains constant despite stopping and starting of the clock by modification of the cke0 bit. 15.4.6 data transmission and reception initialization: initialize the sci using the following procedure before sending or receiving data. initialization is also required for switching from transmit mode to receive mode or from receive mode to transmit mode. figure 15.5 shows an example of initialization process flowchart. 1. clear te and re in scscr to 0. 2. clear error flags fer/ers, per, and orer to 0 in scssr. 3. set the c/ a bit, parity bit (o/ e bit), and baud rate generator select bits (cks1 and cks0 bits) in scsmr. at this time also clear the chr and mp bits to 0 and set the stop and pe bits to 1. 4. set the smif, sdir, and sinv bits in scscmr. when the smif bit is set to 1, the txd and rxd pins both switch from ports to sci pins and become high impedance. 5. set the value corresponding to the bit rate in scbrr. 6. set the clock source select bits (cke1 and cke0 bits) in scscr. clear the tie, rie, te, re, mpie, and teie bits to 0. when the cke0 bit is set to 1, a clock is output from the sck pin. 7. after waiting at least 1 bit, set the tie, rie, te, and re bits in scscr. do not set the te and re bits simultaneously unless performing self-diagnosis.
rev. 4.00, 03/04, page 413 of 660 initialize clear te and re bits in scscr to 0 set value in scbrr clear scssr's fer/ers, per and orer flags to 0 wait set scscr's tie, rie, te, and re bits has a 1-bit interval elapsed? end set scsmr's o/ bit to parity, set cks1 and cks0 bits to the clock and set c/ set scscr's cke1 and cke0 bits to the clock and clear tie, rie, te, re, mpie, and teie bits to 0 no yes set scsmr's smif, sdir, and sinv bits figure 15.5 initialization flowchart (example) serial data transmission: the processing procedures in the smart card mode differ from ordinary sci processing because data is retransmitted when an error signal is sampled during a data transmission. an example of transmission processing flowchart is shown in figure 15.6. 1. initialize the smart card interface mode as described in initialization above. 2. check that the fer/ers bit in scssr is cleared to 0. 3. repeat steps 2 and 3 until the tend flag in scssr is set to 1. 4. write the transmit data into sctdr, clear the tdre flag to 0 and start transmitting. the tend flag will be cleared to 0. 5. to transmit more data, return to step 2. 6. to end transmission, clear the te bit to 0.
rev. 4.00, 03/04, page 414 of 660 this processing can be interrupted. when the tie bit is set to 1 and interrupt requests are enabled, a transmit-data-empty interrupt (txi) will be requested when the tend flag is set to 1 at the end of the transmission. when the rie bit is set to 1 and interrupt requests are enabled, a communication error interrupt (eri) will be requested when the ers flag is set to 1 when an error occurs in transmission. see interrupt operation below for more information. start end transmission start transmission initialize write transmit data in sctdr and clear tdre flag in scssr to 0 clear te bit in scscr to 0 error processing fer/ers = 0? tend = 1? yes yes yes yes no no all data transmitted? no tend = 1? no error processing fer/ers = 0? yes no figure 15.6 transmission flowchart serial data reception: the processing procedures in the smart card mode are the same as in ordinary sci processing. the reception processing flowchart is shown in figure 15.7.
rev. 4.00, 03/04, page 415 of 660 1. initialize the smart card interface mode as described above in initialization and in figure 15.5. 2. check that the orer and per flags in scssr are cleared to 0. if either flag is set, clear both to 0 after performing the appropriate error processing procedures. 3. repeat steps 2 and 3 until the rdrf flag is set to 1. 4. read the receive data from scrdr. 5. to receive more data, clear the rdrf flag to 0 and return to step 2. 6. to end reception, clear the re bit to 0. this processing can be interrupted. when the rie bit is set to 1 and interrupt requests are enabled, a receive-data-full interrupt (rxi) will be requested when the rdrf flag is set to 1 at the end of the reception. when an error occurs during reception and either the orer or per flag is set to 1, a communication error interrupt (eri) will be requested. see interrupt operation below for more information. the received data will be transferred to scrdr even when a parity error occurs during reception and per is set to 1, so this data can still be read. start end reception start reception initialize write receive data from scrdr and clear rdrf flag in scssr to 0 clear re bit in scscr to 0 error processing orer = 0 or per = 0? rdrf = 1? yes yes yes no no all data received? no figure 15.7 reception flowchart (example)
rev. 4.00, 03/04, page 416 of 660 switching modes: when switching from receive mode to transmit mode, check that the receive operation is completed before starting initialization and setting re to 0 and te to 1. the rdrf, per, and orer flags can be used to check if reception is completed. when switching from transmit mode to receive mode, check that the transmit operation is completed before starting initialization and setting te to 0 and re to 1. the tend flag can be used to check if transmission is completed. interrupt operation: in the smart card interface mode, there are three types of interrupts: transmit-data-empty (txi), communication error (eri) and receive-data-full (rxi). in this mode, the transmit-end interrupt (tei) cannot be requested. set the tend flag in scssr to 1 to request a txi interrupt. set the rdrf flag in scssr to 1 to request an rxi interrupt. set the orer, per, or fer/ers flag in scssr to 1 to request an eri interrupt (table 15.8). table 15.8 smart card mode operating state and interrupt sources mode state flag mask bit interrupt source normal tend tie txi transmit mode error fer/ers rie eri normal rdrf rie rxi receive mode error per, orer rie eri 15.5 usage note when the sci is used as a smart card interface, be sure that all criteria in sections 15.4.1 and 15.4.2 are applied. receive data timing and receive margin in asynchronous mode: in asynchronous mode, the sci runs on a basic clock with a frequency of 372 times the transfer rate. during reception, the sci samples the falling of the start bit using the base clock to achieve internal synchronization. receive data is latched internally on the rising edge of the 186th basic clock cycle (figure 15.8).
rev. 4.00, 03/04, page 417 of 660 0 185 371 0 185 371 0 base clock receive data (rxd) synchro- nization sampling timing data sampling timing 186 clock cycles 372 clock cycles start bit d0 d1 figure 15.8 receive data sampling timing in smart card mode the receive margin is found from the following equation: for smart card mode: m = (0.5 ? ) 1 2n d ? 0.5 n ? (l ? 0.5)f ? (1 + f) where: m = receive margin (%) n = ratio of bit rate to clock (n = 372) d = clockduty(d = 0to1.0) l = frame length (l = 10) f = absolute value of clock frequency deviation using this equation, the receive margin when f = 0andd = 0.5isasfollows: when d = 0.5 and f = 0: m = (0.5?1/2 372) 100 %= 49.866 %
rev. 4.00, 03/04, page 418 of 660 retransmission (receive and transmit modes): retransmission by the sci in receive mode: figure 15.9 shows the retransmission operation in the sci receive mode. 1. when the received parity bit is checked and an error is found, the per bit in scssr is automatically set to 1. if the rie bit in scscr is enabled at this time, an eri interrupt is requested. be sure to clear the per bit before the next parity bit is sampled. 2. the rdrf bit in scssr is not set in the frame that caused the error. 3. when the received parity bit is checked and no error is found, the per bit in scssr is not set. 4. when the received parity bit is checked and no error is found, reception is considered to have been completed normally and the rdrf bit in scssr is automatically set to 1. if the rie bit in scscr is enabled at this time, an rxi interrupt is requested. 5. when a normal frame is received, the pin maintains a three-state state when it transmits the error signal. d0 ds d2 d1 d4 d3 d6 d5 dp de d7 d0 ds d2 d1 d4 d3 d6 d5 dp (de) d7 d0 ds d2 d1 d4 d3 nth transfer frame rdrf per * 2 * 1 * 4 * 5 * 3 retransmitted frame transfer frame n + 1 notes: 1. 2. 3. 4. 5. this portion corresponds to the above explanation 1. this portion corresponds to the above explanation 2. this portion corresponds to the above explanation 3. this portion corresponds to the above explanation 4. this portion corresponds to the above explanation 5. figure 15.9 retransmission in sci receive mode
rev. 4.00, 03/04, page 419 of 660 retransmission by the sci in transmit mode: figure 15.10 shows the retransmission operation in the sci transmit mode. 1. after transmission of one frame is completed, the fer/ers bit in scssr is set to 1 when a error signal is returned from the receiving side. if the rie bit in scscr is enabled at this time, an eri interrupt is requested. be sure to clear the fer/ers bit before the next parity bit is sampled. 2. the tend bit in scssr is not set in the frame that received the error signal that indicated the error. 3. the fer/ers bit in scssr is not set when no error signal is returned from the receiving side. 4. when no error signal is returned from the receiving side, the tend bit in scssr is set to 1 when the transmission of the frame that includes the retransmission is considered completed. if the tie bit in scscr is enabled at this time, a txi interrupt will be requested. d0 ds d2 d1 d4 d3 d6 d5 dp de d7 d0 ds d2 d1 d4 d3 d6 d5 dp (de) d7 d0 ds d2 d1 d4 d3 nth transfer frame tend fer/ers transfer from tdr to trs transfer from tdr to trs transfer from tdr to trs * 1 * 2 * 4 * 3 retransmitted frame transfer frame n + 1 tdre notes: 1. 2. 3. 4. this portion corresponds to the above explanation 1. this portion corresponds to the above explanation 2. this portion corresponds to the above explanation 3. this portion corresponds to the above explanation 4. figure 15.10 retransmission in sci transmit mode support for block transfer mode : this smart card interface conforms to the t = 0 (character transfer) protocols of iso/iec7816-3. as a result, this smart card interface does not support block transfer, in which error signals are neither sent nor detected, and data is not automatically retransmitted.
rev. 4.00, 03/04, page 420 of 660
rev. 4.00, 03/04, page 421 of 660 section 16 serial communication interface with fifo (scif) this lsi has single-channel serial communication interface with fifo (scif) that supports asynchronous serial communication. it also has 16-stage fifo registers for both transfer and receive that enables this lsi efficient high-speed continuous communication. figure 16.1 shows a diagram of the scif, and figures 16.2 to 16.4 show the i/o ports. 16.1 feature ? asynchronous serial communication ? serial data communications are performed by start-stop in character units. the sci can communicate with a universal asynchronous receiver/transmitter (uart), an asynchronous communication interface adapter (acia), or any other communications chip that employs a standard asynchronous serial system. there are eight selectable serial data communication formats. ? data length: seven or eight bits ? stop bit length: one or two bits ? parity: even, odd, or none ? receive error detection: parity and framing errors ? break detection: ? full duplex communication the transmitting and receiving sections are independent, so the sci can transmit and receive simultaneously. both sections use 16-stage fifo buffering, so high-speed continuous data transfer is possible in both the transmit and receive directions. ? on-chip baud rate generator with selectable bit rates ? internal or external transmit/receive clock source from either baud rate generator (internal) or sck2 pin (external) ? four types of interrupts transmit-fifo-data-empty, break, receive-fifo-data-full, and receive-error interrupts are requested independently. the direct memory access controller (dmac) can be activated to execute a data transfer by a transmit-fifo-data-empty or receive-fifo-data-full interrupt. ? when the scif is not in use, it can be stopped by halting the clock supplied to it, saving power. ? on-chip modem control functions ( rts2 and cts2 ) ? the quantity of data in the transmit and receive fifo registers and the number of receive errors of the receive data in the receive fifo register can be known. ? the time-out error (dr) can be detected in receiving.
rev. 4.00, 03/04, page 422 of 660 rxd2 txd2 sck2 scif scbrr2 scssr2 scscr2 scftdr2 sctsr2 scfrdr2 scrsr2 scsmr2 scfdr2 scfcr2 scpcr scpdr parity generation parity check clock external clock module data bus internal data bus p p /4 p /16 p /64 txi tei rxi bvri bus interface baud rate generator transmit/ receive control scrsr2: scfrdr2: sctsr2: scftdr2: scsmr2: scscr2: receive shift register 2 receive fifo data register 2 transmit shift register 2 transmit fifo data register 2 serial mode register 2 serial control register 2 scssr2: scbrr2: scfcr2: scfdr2: scpdr: scpcr: serial status register 2 bit rate register 2 fifo control register 2 number of fifo data register 2 port sc data register port sc control register legend (16 stages) (16 stages) figure 16.1 scif block diagram
rev. 4.00, 03/04, page 423 of 660 internal data bus output enable clock input enable scif serial clock output serial clock input r scp3md0 pcrw reset c q q d r scp3md1 pcrw reset c d r scp3dt1 pdrw reset scpt[3]/sck2 c d pdrw: scpdr write pdrr: pcrw: scpdr read scpcr write pdrr * note: * when reading the sck2 pin, clear the cke1 and cke0 bits in scscr to 0, and set the scp3md1 bit in scspr to 1. legend figure 16.2 scpt[3]/sck2 pin
rev. 4.00, 03/04, page 424 of 660 internal data bus output enable scif serial transmission output q r scp2dt1 pdrw reset scpt[2]/txd2 c d r scp2md0 pcrw reset c q d r scp2md1 pcrw reset c q d legend pcrw: pdrw: scpcr write scpdr write figure 16.3 scpt[2]/txd2 pin scif serial receive data internal data bus pdrr * scpt[2]/rxd2 pdrr: scpdr read note: * when reading the rxd2 pin, set the re bit in scscr to 1. legend figure 16.4 scpt[2]/rxd2 pin
rev. 4.00, 03/04, page 425 of 660 16.2 input/output pin the scif has the i/o pins summarized in table 16.1. table 16.1 scif pins pin name abbreviation i/o function serial clock pin sck2 i/o clock i/o receive data pin rxd2 input receive data input transmit data pin txd2 output transmit data output request to send pin rts2 output request to send clear to send pin cts2 input clear to send 16.3 register description scif has the registers listed below. these registers specify the data format and bit rate, and control the transmitter and receiver sections. refer to section 23, list of registers, for more details of the addresses and access sizes. ? serial mode register 2 (scsmr2) ? bit rate register 2 (scbrr2) ? serial control register 2 (scscr2) ? transmit fifo data register 2 (scftdr2) ? serial status register 2 (scssr2) ? receive data fifo register 2 (scfrdr2) ? fifo control register 2 (scfcr2) ? fifo data count set register 2 (scfdr2) ? sc port control register (scpcr) ? sc port data register (scpdr)
rev. 4.00, 03/04, page 426 of 660 16.3.1 receive shift register 2 (scrsr2) the receive shift register 2 (scrsr2) is an eight-bit register taht receives serial data. the cpu cannot read from or write to the scrsr2 directly. data input at the rxd pin is loaded into the scrsr2 in the order received, lsb (bit 0) first, converting the data to parallel form. when one byte has been received, it is automatically transferred to the scfrdr2, which is a receive fifo register. 16.3.2 receive fifo data register 2 (scfrdr2) the 16-byte receive fifo data register2(scfrdr2) stores serial receive data. the scif completes the reception of one byte of serial data by moving the received data from the scrsr2 into the scfrdr2 for storage. continuous receive is possible until 16 bytes are stored. the cpu can read but not write the scfrdr2. when data is read without received data in the scfrfr2, the value is undefined. when the received data in this register becomes full, the subsequent serial data is lost. 16.3.3 transmit shift register 2 (sctsr2) the transmit shift register 2 (sctsr2) is an eight-bit register that transmits serial data. the cpu cannot read from or write to the sctsr2 directly. the sci loads transmit data from the scftdr2 into the sctsr2, then transmits the data serially from the txd pin, lsb (bit 0) first. after transmitting one data byte, the sci automatically loads the next transmit data from the scftdr2 into the sctsr2 and starts transmitting again. 16.3.4 transmit fifo data register 2 (scftdr2) the transmit fifo data register 2 (scftdr2) is a 16-byte fifo register that stores data for serial transmission. when the scif detects that the sctsr is empty, it moves transmit data written in the scftdr2 into the sctsr2 and starts serial transmission. continuous serial transmission is performed until the transmit data in the scftdr2 becomes empty. the cpu can always write to the scftdr2. when the transmit data in the scftdr2 is full (16 bytes), next data cannot be written. if attempted to write, the data is ignored. 16.3.5 serial mode register 2 (scsmr2) the serial mode register2 (scsmr2) is an eight-bit register that specifies the scif serial communication format and selects the clock source for the baud rate generator. the cpu can always read and write the scsmr2.
rev. 4.00, 03/04, page 427 of 660 bit bit name initial value r/w description 7? 0 rreserved this bit is always read 0. the write value should always be 0. 6 chr 0 r/w character length selects seven-bit or eight-bit data in the asynchronous mode. 0: eight-bit data. 1: seven-bit data. note: when seven-bit data is selected, the msb (bit 7) in scftpr2 is not transmitted. 5 pe 0 r/w parity enable selects whether to add a parity bit to transmit data and to check the parity of receive data. 0: parity bit not added or checked. 1: parity bit added and checked. note:whenpeissetto1,anevenoroddparity bit is added to transmit data, depending on the parity mode (o/ e ) setting. receive data parity is checked according to the even/odd (o/ e ) mode setting. 4o/ e 0 r/w parity mode selects even or odd parity when parity bits are added and checked. the o/ e setting is used only when the pe is set to 1 to enable parity addition and check. the o/ e setting is ignored when parity addition and check is disabled. 0: even parity. note: if even parity is selected, the parity bit is added to transmit data to make an even number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an even number of 1s in the received character and parity bit combined. 1: odd parity. note: if odd parity is selected, the parity bit is added to transmit data to make an odd number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an odd number of 1s in the received character and parity bit combined.
rev. 4.00, 03/04, page 428 of 660 bit bit name initial value r/w description 3 stop 0 r/w stop bit length selects one or two bits as the stop bit length. in receiving, only the first stop bit is checked, regardless of the stop bit setting. if the second stop bit is 1, it is treated as a stop bit, but if the second stop bit is 0, it is treated as the start bit of the next incoming character. 0: one stop bit. note: in transmitting, a single bit of 1 is added at the end of each transmitted character. 1:twostopbits. note:in transmitting, two bits of 1 are added at the end of each transmitted character. 2? 0 rreserved this bit is always read as 0. the write value should always be 0. 1 0 cks1 cks0 0 0 r/w r/w clock select 1 and 0 these bits select the internal clock source of the on-chip baud rate generator. four clock sources are available. p ,p /4, p /16 and p /64. for further information on the clock source, bit rate register settings, and baud rate, see section 16.3.8, bit rate register 2 (scbrr2). 00: p 01: p /4 10: p /16 11: p /64 note: p : peripheral clock
rev. 4.00, 03/04, page 429 of 660 16.3.6 serial control register 2 (scscr2) the serial control register 2 (scscr2) operates the sci transmitter/receiver, selects the serial clock output in the asynchronous mode, enables/disables interrupt requests, and selects the transmit/receive clock source. the cpu can always read and write the scscr2. bit bit name initial value r/w description 7 tie 0 r/w transmit interrupt enable enables or disables the transmit-fifo-data-empty interrupt (txi) requested when the serial transmit data is transferred from the scftdr2 to sctsr2, and the quantity of data in the scftdr2 becomes less than the specified number of transmission triggers, and then the tdfe flag in the scssr2 is set to1. 0: transmit-fifo-data-empty interrupt request (txi) is disabled. note: the txi interrupt request can be cleared by writing the greater quantity of transmit data than the specified number of transmission triggers to scftdr2 and by clearing tdfe to 0 after reading 1 from tdfe, or can be cleared by clearing tie to 0. 1: transmit-fifo-data-empty interrupt request (txi) is enabled. 6 rie 0 r/w receive interrupt enable enables or disables the receive-data-full (rxi) and receive-error (eri) interrupts requested when the serial receive data is transferred from the scrsr2 to scfrdr2, when the quantity of data in the scfrdr2 becomes more than the specified number of receive triggers, and when the rdrf flag of scssr2 is set to1. 0: receive-data-full interrupt (rxi), receive-error interrupt (eri), and receive break interrupt (bri) requests are disabled. note: rxi and eri interrupt requests can be cleared by reading the dr, er, or rdf flag after it has been set to 1, then clearing the flag to 0, or by clearing rie to 0. at rdf, read 1 from the rdf flag and clear it to 0, after reading the received data from scfrdr2 until the quantity of received data becomes less than the specified number of the receive triggers. 1: receive-data-full interrupt (rxi) and receive- error interrupt (eri) requests are enabled.
rev. 4.00, 03/04, page 430 of 660 bit bit name initial value r/w description 5 te 0 r/w transmit enable enables or disables the scif serial transmitter. 0: transmitter disabled. 1: transmitter enabled. note: serial transmission starts after writing of transmit data into the scftdr2. select the transmit format in the scsmr2 and scfcr2 and reset the tfifo before setting te to 1. 4 re 0 r/w receive enable enables or disables the scif serial receiver. 0: receiver disabled. note: clearing re to 0 does not affect the receive flags (dr, er, brk, fer and per). these flags retain their previous values. 1: receiver enabled. note: serial reception starts when a start bit is detected. select the receive format in the scsmr2 before setting re to 1. 3, 2 ? all 0 r/w reserved these bits are always read as 0. the write value should always be 0. 1 0 cke1 cke0 0 0 r/w r/w clock enable these bits select the scif clock source and enable or disable clock output from the sck2 pin. depending on the combination of cke1 and cke0, the sck2 pin can be used for serial clock output or serial clock input. the cke0 setting is valid only when the sci is operating with the internal clock (cke1 = 0). the cke0 setting is ignored when an external clock source is selected (cke1 = 1). always select the scif operating mode in the scsmr2, before setting cke1 and cke0. for further details on selection of the scif clock source, see table 16.7 in section 16.4, operation. 00: internal clock, sck pin used for input pin (input signal is ignored) 01: internal clock, sck2 pin used for clock output * 1 10: external clock, sck2 pin used for clock input * 2 11: external clock, sck2 pin used for clock input * 2 notes: 1. the output clock frequency is 16 times the bit rate. 2. the input clock frequency is 16 times the bit rate.
rev. 4.00, 03/04, page 431 of 660 16.3.7 serial status register 2 (scssr2) the serial status register 2 (scssr2) is a 16-bit register. the upper 8 bits indicate the number of receive errors in the data of the scfrdr2, and the lower 8 bits indicate scif operating state. the cpu can always read and write the scssr2, but cannot write 1 to the status flags (er, tend, tdfe, brk, oper, and dr). these flags can be cleared to 0 only if they have first been read (after being set to 1). bits 3 (fer) and 2 (per) are read-only bits and cannot be written. bit bit name initial value r/w description 15 to 12 per3 to per0 all 0 r number of parity errors these bits indicate the number of data items that contain a parity error in the receive data stored in the scfrdr2. (the number of parity errors in the scfrdr2) 11 to 8 fer3 to fer0 all 0 r number of framing errors these bits indicate the number of data items that contain a framing error in the receive data stored in the scfrdr2. (the number of framing errors in the scfrdr2)
rev. 4.00, 03/04, page 432 of 660 bit bit name initial value r/w description 7er 0 r/(w) * receive error indicates that a framing error or a parity error, when receiving data containing parity bits, has occurred. 0: receive is in progress, or receive is normally completed. * 1 [clearing conditions] 1. the chip is power-on reset or enters standby mode. 2. er is read as 1, then written to with 0. 1: a framing error or a parity error has occurred during receiving. er is set to 1 when the stop bit is 0 after checking whether or not the last stop bit of the received data is 1 at the end of one-data receive * , or when the total number of 1's in the received data and in the parity bit does not match the even/odd parity specification specified by the o/ e bit of the scsmr. [setting conditions] 1. the stop bit is 0 after checking whether or not the last stop bit of the received data is 1 at the end of one-data receive. * 2 2. the total number of 1's in the received data and in the parity bit does not match the even/odd parity specification specified by the o/ e bit of the scsmr2. notes: 1. clearing the re bit to 0 in scscr2 does not affect the er bit, which retains its previous value. even if a receive error occurs, the received data is transferred to scfrdr2 and the receive operation is continued. whether or not the data read from scrdr2 includes a receive error can be detected by the fer and per bits of scssr2. 2. n the stop mode, only the first stop bit is checked; the second stop bit is not checked.
rev. 4.00, 03/04, page 433 of 660 bit bit name initial value r/w description 6tend1 r/(w) * transmit end indicates that when the last bit of a serial character was transmitted, the scftdr2 did not contain valid data, so transmission has ended. 0: transmission is in progress. [clearing condition] data is written to scftdr2. 1: end of transmission [setting conditions] 1. when the chip is reset or enters standby mode, te in the scscr2 is cleared to 0. 2. scftdr2 contains no transmit data when the last bit of a one-byte serial character is transmitted.
rev. 4.00, 03/04, page 434 of 660 bit bit name initial value r/w description 5 tdfe 1 r/(w) * transmit fifo data empty indicates that data is transferred from scftdr2 to sctsr2, the quantity of data in scftdr2 becomes less than the number of transmission triggers specified by the ttrg1 and ttrg0 bits in scfcr2, and writing the transmit data to scftdr is enabled. 0: the quantity of transmit data written to scftdr2 is equal to or greater than the specified number of transmission triggers. [clearing condition] when data exceeding the specified number of transmission triggers is written to scftdr2, software reads tdfe after it has been set to 1, then writes 0 to tdfe 1: end of transmission [setting conditions] 1. the chip is power-on reset or enters standby mode. 2. the quantity of transmission data in scftdr2 becomes less than the specified number of transmission triggers as a result of transmission. note: since scftdr2 is a 16-byte fifo register, the maximum quantity of data which can be written when tdfe is 1 is "16 minus the specified number of transmission triggers". if attempted to write additional data, the data is ignored. the quantity of data in scftdr2 is indicated by the upper 8 bits of scftdr2.
rev. 4.00, 03/04, page 435 of 660 bit bit name initial value r/w description 4brk 0 r/(w) * break detection indicates that a break signal is detected in received data. 0: no break signal is being received. [clearing conditions] 1. the chip is power-on reset or enters standby mode. 2. brkisreadas1,thenwrittentowith0. 1: a break signal is received. [setting conditions] 1. data including a framing error is received. 2. a framing error with space 0 occurs in the subsequent received data. note: when a break is detected, transfer of the received data (h'00) to scfrdr2 stops after detection. when the break ends and the receive signal becomes mark 1, the transfer of the received data resumes. the received data of a frame in which a break signal is detected is transferred to scfrdr2. after this, however, no received data is transferred until a break ends with the received signal being mark 1 and the next data is received. 3 fer 0 r framing error indicates a framing error in the data read from the scfrdr2. 0: no framing error occurred in the data read from scfrdr2. [clearing conditions] 1. the chip is power-on reset or enters standby mode. 2. no framing error is present in the data read from scfrdr2. 1: a framing error occurred in the data read from scfrdr2. [setting condition] a framing error is present in the data read from scfrdr2
rev. 4.00, 03/04, page 436 of 660 bit bit name initial value r/w description 2 per 0 r parity error indicates a parity error in the data read from the scfrdr2. 0: no parity error occurred in the data read from scfrdr2. [clearing conditions] 1. the chip is power-on reset or enters standby mode. 2. no parity error is present in the data read from scfrdr2. 1: a parity error occurred in the data read from scfrdr2. [setting condition] a parity error is present in the data read from scfrdr2
rev. 4.00, 03/04, page 437 of 660 bit bit name initial value r/w description 1 rdf 0 r/(w) * receivefifodatafull indicates that received data is transferred to the scfrdr2, the quantity of data in scfrdr becomes more than the number of receive triggers specified by the rtrg1 and rtrg0 bits in scfcr2. 0: the quantity of transmit data written to scfrdr2 is less than the specified number of receive triggers. [clearing conditions] 1. the chip is power-on reset or enters standby mode. 2. when scfrdr2 is read until the quantity of receive data in scfrdr2 becomes less than the specified number of receive triggers, software reads rdf after it has been set to 1, and then writes 0 to rdf. 1: the quantity of receive data in scfrdr2 is more than the specified number of receive triggers. [setting condition] the quantity of receive data which is greater than the specified number of receive triggers is being stored to scfrdr2. * note: * since scftdr2 is a 16-byte fifo register, the maximum quantity of data which can be read when rdf is 1 is the specified number of receive triggers. if attempted to read after all data in the scfrdr2 have been read, the data is undefined. the quantity of receive data in scfrdr2 is indicated by the lower 8 bits of scftdr2.
rev. 4.00, 03/04, page 438 of 660 bit bit name initial value r/w description 0dr 0 r/(w) * receive data ready indicates that the scfrdr2 stores the data which is less than the specified number of receive triggers, and that next data is not yet received after 15 etu has elapsed from the last stop bit. 0: receive is in progress, or no received data remains in scfrdr2 after the receive ended normally. [clearing conditions] 1. the chip is power-on reset or enters standby mode. 2. dr is read as 1, then written to with 0. 1: next receive data is not received. [setting condition] scfrdr2 stores the data which is less than the specified number of receive triggers, and that next data is not yet received after 15 etu has elapsed from the last stop bit. * note: * this is equivalent to 1.5 frames with the 8-bit 1-stop-bit format. (etu: elementary time unit) note: * the only value that can be written is 0 to clear the flag.
rev. 4.00, 03/04, page 439 of 660 16.3.8 bit rate register 2 (scbrr2) the bit rate register 2 (scbrr2) is an eight-bit register that, together with the baud rate generator clock source selected by the cks1 and cks0 bits in the scsmr2, determines the serial transmit/receive bit rate. the cpu can always read and write the scbrr2. the scbrr2 is initialized to h'ff by a reset or in module standby or standby mode. each channel has independent baud rate generator control, so different values can be set in two channels. the scbrr2 setting is calculated as follows: asynchronous mode: n = p 64 2 2n ? 1 b 10 6 ?1 b: bit rate (bit/s) n: scbrr2 setting for baud rate generator (0 n 255) p : operating frequency for peripheral modules (mhz) n: baud rate generator clock source (n = 0, 1, 2, 3) (for the clock sources and values of n, see table 16.2.) table 16.2 scsmr2 settings scsmr2 settings n clock source cks1 cks0 0p 00 1p /4 0 1 2p /16 1 0 3p /64 1 1 note: find the bit rate error by the following formula: error (%) = p 10 6 ? 1 100 (n+1) 64 2 2n ? 1 b
rev. 4.00, 03/04, page 440 of 660 table 16.3 lists examples of scbrr2 settings. table 16.3 bit rates and scbrr2 settings p % % % % % % % % % % % % 110 2 130 ?0.07 2 141 0.03 1 174 ?0.26 150 2 95 0.00 2 103 0.16 1 127 0.00 300 1 191 0.00 1 207 0.16 0 255 0.00 600 1 95 0.00 1 103 0.16 0 127 0.00 1200 0 191 0.00 0 207 0.16 0 255 0.00 2400 0 95 0.00 0 103 0.16 0 127 0.00 4800 0 47 0.00 0 51 0.16 0 63 0.00 9600 0 23 0.00 0 25 0.16 0 31 0.00 19200 0 11 0.00 0 12 0.16 0 15 0.00 31250 0 6 5.33 0 7 0.00 0 9 ?1.70 38400 0 5 0.00 0 6 ?6.99 0 1 0.00 p % % % % % % % % % % % % 110 2 177 ?0.25 1 212 0.03 2 217 0.08 150 2 129 0.16 1 155 0.16 2 159 0.00 300 2 64 0.16 1 77 0.16 2 79 0.00 600 1 129 0.16 0 155 0.16 1 159 0.00 1200 1 64 0.16 0 77 0.16 1 79 0.00 2400 0 129 0.16 0 38 0.16 0 159 0.00 4800 0 64 0.16 0 19 0.16 0 79 0.00 9600 0 32 ?1.36 0 9 0.16 0 39 0.00 19200 0 15 1.73 0 4 0.16 0 19 0.00 31250 0 9 0.00 0 2 0.00 0 11 2.40 38400 0 7 1.73 0 9 ?2.34 0 9 0.00
rev. 4.00, 03/04, page 441 of 660 p % % % % % % % % % % % % % % % % 110 3 64 0.70 3 70 0.03 3 86 0.31 3 88 ?0.25 150 2 191 0.00 2 207 0.16 2 255 0.00 2 64 0.16 300 2 95 0.00 2 103 0.16 2 127 0.00 2 129 0.16 600 1 191 0.00 1 207 0.16 1 255 0.00 1 64 0.16 1200 1 95 0.00 1 103 0.16 1 127 0.00 1 129 0.16 2400 0 191 0.00 0 207 0.16 0 255 0.00 0 64 0.16 4800 0 95 0.00 0 103 0.16 0 127 0.00 0 129 0.16 9600 0 47 0.00 0 51 0.16 0 63 0.00 0 64 0.16 19200 0 23 0.00 0 25 0.16 0 31 0.00 0 32 ?1.36 31250 0 14 ?1.70 0 15 0.00 0 19 ?1.70 0 19 0.00 38400 0 11 0.00 0 12 0.16 0 15 0.00 0 15 1.73 115200 0 3 0.00 0 3 8.51 0 4 6.67 0 4 8.51 500000 0 0 ?7.84 0 0 0.00 0 0 22.9 0 0 25.0 p % % % % % % % % % % % % % % % % 110 3 106 ?0.44 3 108 0.08 3 126 0.31 3 132 0.13 150 3 77 0.16 3 79 0.00 3 92 0.46 3 97 ?0.35 300 2 155 0.16 2 159 0.00 2 186 ?0.08 2 194 0.16 600 2 77 0.16 2 79 0.00 2 92 0.46 2 97 ?0.35 1200 1 155 0.16 1 159 0.00 1 186 ?0.08 1 194 0.16 2400 1 77 0.16 1 79 0.00 1 92 0.46 1 97 ?0.35 4800 0 155 0.16 0 159 0.00 0 186 ?0.08 0 194 ?1.36 9600 0 77 0.16 0 79 0.00 0 92 0.46 0 97 ?0.35 19200 0 38 0.16 0 39 0.00 0 46 ?0.61 0 48 ?0.35 31250 0 23 0.00 0 24 ?1.70 0 28 ?1.03 0 29 0.00 38400 0 19 ?2.34 0 19 0.00 0 22 1.55 0 23 1.73 115200 0 6 ?6.99 0 6 ?4.76 0 7 ?2.68 0 7 1.73 500000 0 1 ?25.0 0 1 ?23.2 0 1 ?10.3 0 1 ?6.25
rev. 4.00, 03/04, page 442 of 660 p % % % % 110 3 147 0.00 150 3 108 -0.43 300 2 216 0.03 600 2 108 -0.43 1200 1 216 0.03 2400 1 108 -0.43 4800 0 216 0.03 9600 0 108 -0.43 19200 0 53 0.49 31250 0 32 1.03 38400 26 0.49 11520 0 8 0.49 500000 0 1 4.19 table 16.4 lists the maximum bit rates in the asynchronous mode when the baud rate generator is used. table 16.5 lists the maximum bit rates when an external clock input is used. table 16.4 maximum bit rates for various frequencies with baud rate generator (asynchronous mode) settings p 8 250000 0 0 9.8304 307200 0 0 12 375000 0 0 14.7456 460800 0 0 16 500000 0 0 19.6608 614400 0 0 20 625000 0 0 24 750000 0 0 24.576 768000 0 0 28.7 896875 0 0 30 937500 0 0
rev. 4.00, 03/04, page 443 of 660 table 16.5 maximum bit rates during external clock input (asynchronous mode) p 8 2.0000 125000 9.8304 2.4576 153600 12 3.0000 187500 14.7456 3.6864 230400 16 4.0000 250000 19.6608 4.9152 307200 20 5.0000 312500 24 6.0000 375000 24.576 6.1440 384000 28.7 7.1750 448436 30 7.5000 468750 16.3.9 fifo control register 2 (scfcr2) the fifo control register 2 (scfcr2) resets the number of data in the scftdr2 and scfrdr2, sets the number of trigger data, and contains an enable bit for the loop back test. the scfcr2 is always read and written by the cpu. bit bit name initial value r/w description 7 6 rtrg1 rtrg0 0 0 r/w r/w trigger of the number of receive fifo data set the reference number of the receive data full. the rdf in scssr2 is set to 1, when the receiving data count has exceeded the following trigger number. trigger number of receive data. 00: 1 01: 4 10: 8 11: 14
rev. 4.00, 03/04, page 444 of 660 bit bit name initial value r/w description 5 4 ttrg1 ttrg0 0 0 r/w r/w trigger of the number of transmit fifo data set the reference number of the send data empty. the tdfe in scssr2 is set to 1, when the transmitting data count has fallen the following trigger number. trigger number of transmit data. 00: 8 (8) 01: 4 (12) 10: 2 (14) 11: 1 (15) note: values in brackets mean the number of empty bytes in scftdr when the tdfe is set. 3 mce 0 r/w modem control enable enables the modem control signals cts2 and rts2 . 0: disables the modem signal * 1: enables the modem signal note: * the cts2 is fixed to active 0 regardless of the input value, and the rts2 isalsofixedto0. 2 tfrst 0 r/w transmit fifo data register reset cancels the transmit data in the scftdr2 and resets thedatatotheemptystate. 0: disables reset operation * 1: enables reset operation note: * the reset is executed in a hardware reset or the standby mode. 1 rfrst 0 r/w receivefifodataregisterreset cancels the receive data in the scfrdr2 and resets thedatatotheemptystate. 0: disables reset operation * 1: enables reset operation note: * the reset is executed in a hardware reset or the standby mode. 0 loop 0 r/w loop back test internally connects the transmit output pin (txd2) and receive input pin (rxd2) and enables the loop back test. 0: disables the loop back test 1: enables the loop back test
rev. 4.00, 03/04, page 445 of 660 16.3.10 fifo data count set register 2 (scfdr2) the scfdr2 is a 16-bit register which indicates the number of data stored in the scftdr2 and scfrdr2. thescfdr2isalwaysreadfromthecpu. the upper eight bits of this register indicate the number of transmit data items stored in the scftdr2 that have not yet been transmitted. the h'00 means no transmit data, and the h'10 means that the full of transmit data are stored in the scftdr2. the lower eight bits of this register indicate the number of receive data items stored in the scfrdr2. the h'00 means no receive data, and the h'10 means that the full of receive data are stored in the scfrdr2. bit bit name initial value r/w description 15 to 13 ? all 0 r reserved these bits are always read as 0. 12 to 8 t4 to t0 all 0 r number of non-transmitted data. 7to5 ? all0 r reserved these bits are always read as 0. 4 to 0 r4 to r0 all 0 r number of received data. 16.3.11 sc port control register (scpcr) for information about the sc port control register (scpcr), see section 14.3.8, sc port control register (scpcr). 16.3.12 sc port data register (scpdr) for information about the sc port data register (scpdr), see section 14.3.9, sc port data register (scpdr).
rev. 4.00, 03/04, page 446 of 660 16.4 operation for serial communication, the scif has an asynchronous mode in which characters are synchronized individually. refer to section 14.4.1, operation in asynchronous mode (sci). the scif has the 16-byte fifo buffer for both transmit and receive, reduces an overhead of the cpu, and enables continuous high-speed communication. moreover, it has the rts2 and cts2 signals as the modem control signals. the transmission format is selected in the scsmr2, as listed in table 16.6. the sci clock source is selected by the combination of the cke1 and cke0 bits in scscr2, as listed in table 16.6. ? data length is selectable: seven or eight bits. ? parity and multiprocessor bits are selectable. so is the stop bit length (one or two bits). the combination of the preceding selections constitutes the communication format and character length. ? in receiving, it is possible to detect framing errors (fer), parity errors (per), receive fifo data full, receive data ready, and breaks. ? in transmitting, it is possible to detect transmit fifo data empty. ? the number of stored data for both the transmit and receive fifo registers is displayed. ? an internal or external clock can be selected as the scif clock source. ? when an internal clock is selected, the scif operates using the on-chip baud rate generator, and can output a serial clock signal with a frequency 16 times the bit rate. ? when an external clock is selected, the external clock input must have a frequency 16 times the bit rate. (the on-chip baud rate generator is not used.) table 16.6 scsmr2 settings and scif communication formats scsmr2 settings scif communication format mode bit 6 chr bit 5 pe bit 3 stop data length parity bit stop bit length 01bit 0 1 not set 2bits 01bit 0 1 1 8-bit set 2bits 01bit 0 1 not set 2bits 01bit asynchronous 1 1 1 7-bit set 2bits
rev. 4.00, 03/04, page 447 of 660 table 16.7 scscr2 and scscr2 settings and scif clock source selection scscr2 settings scif transmit/receive clock mode bit 1 cke1 bit 0 cke0 clock source sck2 pin function 0 scif does not use the sck2 pin 0 1 internal outputs a clock with a frequency 16 times the bit rate 0 inputs a clock with frequency 16 times the bit rate asynchronous mode 1 1 external 16.4.1 serial operation transmit/receive formats: table 16.8 lists eight communication formats that can be selected. the format is selected by settings in the scsmr2. table 16.8 serial communication formats scsmr2 bits serial transmit/receive format and frame length chr pe stop 1 2345678 9 10 11 12 0 0 0 start 8-bit data stop 0 0 1 start 8-bit data stop stop 0 1 0 start 8-bit data p stop 0 1 1 start 8-bit data p stop stop 1 0 0 start 7-bit data stop 1 0 1 start 7-bit data stop stop 1 1 0 start 7-bit data p stop 1 1 1 start 7-bit data p stop stop start: start bit stop: stop bit p: parity bit
rev. 4.00, 03/04, page 448 of 660 clock: an internal clock generated by the on-chip baud rate generator or an external clock input from the sck2 pin can be selected as the scif transmit/receive clock. the clock source is selected by bits cke1 and cke0 in the serial control register (scscr2) (table 16.7). when an external clock is input at the sck2 pin, it must have a frequency equal to 16 times the desired bit rate. when the scif operates on an internal clock, it can output a clock signal at the sck2 pin. the frequency of this output clock is 16 times the bit rate. transmitting and receiving data (scif initialization): before transmitting or receiving, clear the te and re bits to 0 in the serial control register (scscr2), then initialize the scif as follows. when changing the communication format, always clear the te and re bits to 0 before following the procedure given below. clearing te to 0 initializes the transmit shift register (sctsr2). clearing te and re to 0, however, does not initialize the serial status register (scssr2), transmit fifo data register (scftdr2), or receive fifo data register (scfrdr2), which retain their previous contents. clear te to 0 after all transmit data are transmitted and the tend flag in the scssr2 is set. the transmitting data enters the high impedance state after clearing to 0 although the bit can be cleared to 0 in transmitting. set the tfrst bit in the scfcr2 to 1 and reset the scftdr2 before te is set again to start transmission. when an external clock is used, the clock should not be stopped during initialization or subsequent operation. scif operation becomes unreliable if the clock is stopped. figure 16.5 is a sample flowchart for initializing the scif. the procedure for initializing the scif is:
rev. 4.00, 03/04, page 449 of 660 initialization 1. set the clock selection in scscr2. be sure to clear bits rie tie, te, and re to 0. when clock output is selected, it is output immediately after scscr2 settings are made. 2. set the data transfer format in scsmr2. 3. write a value corresponding to the scbrr2. (not necessary if an external clock is used.) 4. wait at least one bit interval, then set the te bit or re bit in scsr2 to 1. also set the rie and tie bits. setting the te and re bits enables the txd2 and rxd2 pins to be used. when transmitting, the scif will go to the mark state; when receiving, it will go to the idle state, waiting for a start bit. clear te and re bits in scscr2 to 0 set tfrst and rfrst bits in scfcr2 to 1 1-bit interval elapsed? set rtrg1-0, ttrg1-0, and mce in scfcr2 clear tfrst and rfrst bits to 0 set te and re bits in scscr2 to 1,and set rie, tie, teie, and mpie bits set data transfer format in scsmr2 yes no set value in scbrr2 set cke1 and cke0 bits in scscr2 (leaving te and re bits cleared to 0) end wait figure 16.5 sample scif initialization flowchart
rev. 4.00, 03/04, page 450 of 660 ? serial data transmission figure 16.6 shows a sample flowchart for serial transmission. use the following procedure for serial data transmission after enabling the scif for transmission. start transmission read tdfe bit in scssr2 tend= 1? read tend bit in scssr2 clear te bit in scscr2 to 0 set scpdr and scpcr yes no tdfe= 1? no all data transmitted? no yes yes break output? yes no write transmit data (16 - transmit trigger set number) to scftdr2, read 1 from tdfe bit and tend flag in scssr2, then clear to 0 end of transmission 1. scif status check and transmit data write: read scssr2 and check that the tdfe flag is set to 1, then write transmit data to the scftdr2, read 1 from the tdfe and tend flags, then clear these flags to 0. the number of transmit data bytes that can be written is 16 - (transmit trigger set number). 2. serial transmission continuation procedure: to continue serial transmission, read 1 from the tdfe flag to confirm that writing is possible, then write data to scftdr2, and then clear the tdfe flag to 0. 3. break output at the end of serial transmission: to output a break in serial transmission, set the scpdr and scpcr, then clear the te bit to 0 in the scscr2. for information on scpdr and scpcr, see 16.3.11, sc port control register (scpcr), and 16.3.12, sc port data register (scpdr). in steps 1 and 2, it is possible to ascertain the number of data bytes that can be written from the number of transmit data bytes in scftdr2 indicated by the upper 8 bits of the scfdr2. figure 16.6 sample serial transmission flowchart
rev. 4.00, 03/04, page 451 of 660 in serial transmission, the scif operates as described below. 1. when data is written into the scftdr2, the scif transfers the data from scftdr2 to the transmit shift register (sctsr2) and starts transmitting. confirm that the tdfe flag in scssr2 is set to 1 before writing transmit data to scftdr2. the number of data bytes that can be written is (16 ? transmit trigger setting). 2. when data is transferred from scftdr2 to sctsr2 and transmission is started, consecutive transmit operations are performed until there is no transmit data left in scftdr2. when the number of transmit data bytes in scftdr2 falls below the transmit trigger number set in the scfcr2, the tdfe flag is set. if the tie bit in scscr2 is set to 1 at this time, a transmit- fifo-data-empty interrupt (txi) request is generated. the serial transmit data is sent from the txd2 pin in the following order. a. start bit: one-bit 0 is output. b. transmit data: 8-bit or 7-bit data is output in lsb-first order. c. parity bit: one parity bit (even or odd parity) is output. (a format in which a parity bit is not output can also be selected.) d. stop bit(s): one- or two-bit 1s (stop bits) are output. e. mark state: 1 is output continuously until the start bit that starts the next transmission is sent. 3. the scif checks the scftdr2 transmit data at the timing for sending the stop bit. if data is present, the data is transferred from scftdr2 to sctsr2, the stop bit is sent, and then serial transmission of the next frame is started. if there is no transmit data, the tend flag in scssr2 is set to 1, the stop bit is sent, and then the line goes to the mark state in which 1 is output continuously.
rev. 4.00, 03/04, page 452 of 660 figure 16.7 shows an example of the operation for transmission. 01 1 1 0/1 0 1 tdfe tend parity bit parity bit serial data start bit data stop bit start bit data stop bit idling (marking) txi interrupt request data written to scftdr2 and tdfe flag read as 1 then cleared to 0 by txi interrupt handler one frame d 0 d 1 d 7 d 0 d 1 d 7 0/1 txi interrupt request figure 16.7 example of transmit operation (example with 8-bit data, parity, one stop bit) 4. when modem control is enabled, transmission can be stopped and restarted in accordance with the cts2 input value. when cts2 issetto1,iftransmissionisinprogress,thelinegoesto the mark state after transmission of one frame. when cts2 is set to 0, the next transmit data is output starting from the start bit. figure 16.8 shows an example of the operation when modem control is used. 0 0/1 0 parity bit serial data txd2 start bit stop bit start bit d 0 d 1 d 7 d 0 d 1 d 7 0/1 rise this point before a stop bit figure 16.8 example of operation using modem control ( cts2 cts2 cts2 cts2 )
rev. 4.00, 03/04, page 453 of 660 ? serial data reception figure 16.9 shows a sample flowchart for serial reception. use the following procedure for serial data reception after enabling the scif for reception. start reception read orer, per, fer flags in scssr2 all data received? end reception no yes per = 1 or fer = 1? rdf = 1? yes yes clear re bit in scscr2 to 0 no no read rdf flag in scssr2 error processing read receive data in scfrdr2, and clear rdf flag in scssr2 to 0 1. receive error handling and break detection: read the dr, er, and brk flags in scssr2 to identify any error, perform the appropriate error handling, then clear the dr, er, and brk flags to 0. in the case of a framing error, a break can also be detected by reading the value of the rxd2 pin. 2. scif status check and receive data read : read the scssr2 and check that rdf = 1, then read the receive data in scfrdr2, read 1 from the rdf flag, and then clear the rdf flag to 0. the transition of the rdf flag from 0 to 1 can be identified by an rxi interrupt. 3. serial reception continuation procedure: to continue serial reception, read at least the receive trigger set number of receive data bytes from scfrdr2, read 1 from the rdf flag, then clear the rdf flag to 0. the number of receive data bytes in scfrdr2 can be ascertained by reading the lower bits of scfdr2. figure 16.9 sample serial reception flowchart (1)
rev. 4.00, 03/04, page 454 of 660 error processing end brk= 1? dr= 1? er = 1? yes yes clear dr, er, brk flags in scssr2 to 0 no no no receive error processing break processing read receive data in scfrdr2 1. whether a framing error or parity error has occurred in the receive data read from scfrdr2 can be ascertained from the fer and per bits in scssr2. 2. when a break signal is received, receive data is not transferred to scfrdr2 while the brk flag is set. however, note that the last data in scfrdr2 is h'00 and the break data in which a framing error occurred is stored. figure 16.10 sample serial reception flowchart (2) in serial reception, the scif operates as described below. 1. the scif monitors the transmission line, and if a 0 start bit is detected, performs internal synchronization and starts reception. 2. the received data is stored in scrsr2 in lsb-to-msb order. 3. the parity bit and stop bit are received. after receiving these bits, the scif carries out the following checks. a. stop bit check: the scif checks whether the stop bit is 1. if there are two stop bits, only the first is checked. b. the scif checks whether receive data can be transferred from the receive shift register (scrsr2) to scfrdr2. c. break check: the scif checks that the brk flag is 0, indicating that the break state is not set. if all the above checks are passed, the receive data is stored in scfrdr2. note: reception is not suspended when a receive error occurs.
rev. 4.00, 03/04, page 455 of 660 4. if the rie bit in scscr2 is set to 1 when the rdf or dr flag changes to 1, a receive-fifo- data-full interrupt (rxi) request is generated. if the rie bit in scscr2 is set to 1 when the er flag changes to 1, a receive-error interrupt (eri) request is generated. if the rie bit in scscr2 is set to 1 when the brk flag changes to 1, a break reception interrupt (bri) request is generated. figure 16.11 shows an example of the operation for reception. rdf fer eri interrupt request generated by receive error one frame data read and rdf flag read as 1 then cleared to 0 by rxi interrupt handler rxi interrupt request 01 1 1 0/1 0 1 parity bit parity bit serial data start bit data stop bit start bit data stop bit idling (marking) d 0 d 1 d 7 d 0 d 1 d 7 0/1 figure 16.11 example of scif receive operation (example with 8-bit data, parity, one stop bit) 5. when modem control is enabled, the rts2 signal is output when scfrdr2 is empty. when rts2 is 0, reception is possible. when rts2 is 1, this indicates that scfrdr2 is full and reception is not possible. figure 16.12 shows an example of the operation when modem control is used. 0 0/1 0 1 parity bit serial data rxd2 start bit start d 0 d 1 d 2 d 7 figure 16.12 example of operation using modem control ( rts2 rts2 rts2 rts2 )
rev. 4.00, 03/04, page 456 of 660 16.4.2 scif interrupts the scif has four interrupt sources: transmit-fifo-data-empty (txi), receive-error (eri), receive-data-full (rxi), and break (bri). table 16.9 shows the interrupt sources and their order of priority. the interrupt sources are enabled or disabled by means of the tie and rie bits in scscr2. a separate interrupt request is sent to the interrupt controller for each of these interrupt sources. when the tdfe flag in the scssr2 is set to 1, a txi interrupt request is generated. the dmac can be activated and data transfer performed when this interrupt is generated. the tdfe flag is cleared to 0 when data exceeding the number of transmit triggers is written to scftdr2 by the dmac, the tdfe flag is read as 1, then 0 is written to the tdfe flag. when the rdf flag in scssr2 is set to 1, an rxi interrupt request is generated. the dmac can be activated and data transfer performed when the rdf flag in scssr2 is set to 1. the rdf flag is cleared to 0 when scfrdr2 is read until the quantity of receive data in scfrdr2 becomes less than the specified number of receive triggers by the dmac, the rdf flag is read as 1, then 0 is written to the rdf flag. when the er flag in scssr2 is set to 1, an eri interrupt request is generated. when the brk flag in scssr2 is set to 1, a bri interrupt request is generated. the txi interrupt indicates that transmit data can be written, and the rxi interrupt indicates that there is receive data in scfrdr2. table 16.9 scif interrupt sources interrupt source description dmac activation priority on reset release eri interrupt initiated by receive error flag (er) not possible high rxi interrupt initiated by receive data fifo full flag (rdf) or data ready flag (dr) possible (rdf only) bri interrupt initiated by break flag (brk) not possible txi interrupt initiated by transmit fifo data empty flag (tdfe) possible low see section 4, exception processing, for priorities and the relationship with non-scif interrupts.
rev. 4.00, 03/04, page 457 of 660 16.5 usage notes note the following when using the scif. 1. scftdr2 writing and the tdfe flag the tdfe flag in scssr2 is set when the number of transmit data bytes written in the scftdr2 has fallen below the transmit trigger number set by bits ttrg1 and ttrg0 in the scfcr2. after tdfe is set, transmit data up to the number of empty bytes in scftdr2 can be written, allowing efficient continuous transmission. if the number of data bytes written in scftdr2 is equal to or less than the transmit trigger number, the tdfe flag will be set to 1 again after being cleared to 0. tdfe clearing should therefore be carried out after data more than the specified number of transmit triggers has been written to scftdr2. the number of transmit data bytes in scftdr2 can be found from the upper 8 bits of the scfdr2. 2. scfrdr2 reading and the rdf flag the rdf flag in scssr2 is set when the number of receive data bytes in the scfrdr2 has become equal to or greater than the receive trigger number set by bits rtrg1 and rtrg0 in scfcr2. after rdf is set, receive data equivalent to the trigger number can be read from scfrdr2, allowing efficient continuous reception. however, if the number of data bytes in scfrdr2 is greater than the trigger number, the rdf flag will be set to 1 again even if it is cleared to 0. the rdf flag should therefore be cleared to 0 after being read as 1 after all the receive data has been read. the number of receive data bytes in scfrdr2 can be found from the lower 8 bits of the fifo data count register (scfdr2). 3. break detection and processing break signals can be detected by reading the rxd2 pin directly when a framing error (fer) is detected. in the break state the input from the rxd2 pin consists of all 0s, so the fer flag is set and the parity error flag (per) may also be set. note that, although transfer of receive data to scfrdr2 is halted in the break state, the scif receiver continues to operate, so if the brk flag is cleared to 0 it will be set to 1 again. 4. sending a break signal the i/o condition and level of the txd2 pin are determined by the scp2dt bit in scpdr and bits scp2md0 and scp2md1 in the scpcr. this feature can be used to send a break signal. to send a break signal during serial transmission, clear the scp2dt bit to 0 (designating low level), then set the scp2md0 and scp2md1 bits to 0 and 1, respectively, and finally clear the te bit to 0 (halting transmission). when the te bit is cleared to 0, the transmitter is initialized regardless of the current transmission state, and 0 is output from the txd2 pin. 5. tend flag and te bit processing the tend flag is set to 1 during transmission of the stop bit of the last data. consequently, if the te bit is cleared to 0 immediately after setting of the tend flag has been confirmed, the stop bit will be in the process of transmission and will not be transmitted normally. therefore, the te bit should not be cleared to 0 for at least 0.5 serial clock cycles (or 1.5 cycles if two stop bits are used) after setting of the tend flag setting is confirmed.
rev. 4.00, 03/04, page 458 of 660 6. receive data sampling timing and receive margin the scif operates on a base clock with a frequency of 16 times the transfer rate. in reception, the scif synchronizes internally with the fall of the start bit, which it samples on the base clock. receive data is latched at the rising edge of the eighth base clock pulse. the timing is shown in figure 16.13. 0 1 2 3 4 5 6 7 8 9 10111213 1415 0 1 2 3 4 5 6 7 8 9 10111213 1415 0 1 2 3 4 5 base clock receive data (rxd2) synchro- nization sampling timing data sampling timing 8 clocks 16 clocks start bit ? 7.5 clocks +7.5 clocks d0 d1 figure 16.13 receive data sampling timing in asynchronous mode the receive margin in asynchronous mode can therefore be expressed as shown in equation 1. equation 1: m = 0.5 ? 1 2n d ? 0.5 n ? (l ? 0.5) f ? (1 + f) m: receive margin (%) n: ratio of clock frequency to bit rate (n = 16) d: clock duty cycle (d = 0 to 1.0) l:framelength(l=9to12) f: absolute deviation of clock frequency from equation 1, if f = 0 and d = 0.5, the receive margin is 46.875%, as given by equation 2. equation 2: when d = 0.5 and f = 0: m = (0.5 ? 1/(2 16)) 100 % = 46.875 % this is a theoretical value. a reasonable margin to allow in system designs is 20% to 30%.
rev. 4.00, 03/04, page 459 of 660 section 17 pin function controller (pfc) the pin function controller (pfc) is composed of registers for selecting the function of multiplexed pins and the direction of input/output. the pin function and i/o direction can be selected for each pin individually without regard to the operating mode of the lsi. table 17.1 lists the multiplexed pins. table 17.1 list of multiplexed pins port port function (related module) other function (related module) a pta7 i/o (port) d23 i/o (data bus) a pta6 i/o (port) d22 i/o (data bus) a pta5 i/o (port) d21 i/o (data bus) a pta4 i/o (port) d20 i/o (data bus) a pta3 i/o (port) d19 i/o (data bus) a pta2 i/o (port) d18 i/o (data bus) a pta1 i/o (port) d17 i/o (data bus) a pta0 i/o (port) d16 i/o (data bus) b ptb7 i/o (port) d31 i/o (data bus) b ptb6 i/o (port) d30 i/o (data bus) b ptb5 i/o (port) d29 i/o (data bus) b ptb4 i/o (port) d28 i/o (data bus) b ptb3 i/o (port) d27 i/o (data bus) b ptb2 i/o (port) d26 i/o (data bus) b ptb1 i/o (port) d25 i/o (data bus) b ptb0 i/o (port) d24 i/o (data bus)
rev. 4.00, 03/04, page 460 of 660 port port function (related module) other function (related module) c ptc7 i/o (port) cs6 output (bsc) / ce1b output (bsc) c ptc6 i/o (port) cs5 output 9bsc) / ce1a output (bsc) c ptc5 i/o (port) cs4 output (bsc) c ptc4 i/o (port) cs3 output (bsc) c ptc3 i/o (port) cs2 output (bsc) c ptc2 i/o (port) we3 output (bsc) / dqmuu output (bsc) / iciowr output (bsc) c ptc1 i/o (port) we2 output (bsc) / dqmul output (bsc) / iciord output (bsc) c ptc0 i/o (port) bs output (bsc) d ptd7 i/o (port) ce2b output (pcmcia) d ptd6 i/o (port) ce2a output (pcmcia) d ptd5 i/o (port) iois16 input (pcmcia) d ptd4 i/o (port) cke output (bsc) d ptd3 i/o (port) casu output (bsc) d ptd2 i/o (port) casl output (bsc) d ptd1 i/o (port) rasu output (bsc) d ptd0 i/o (port) rasl output (bsc) e pte7 i/o (port) irqout output e pte6 i/o (port) tclk i/o (timer) e pte5 i/o (port) status1 output (cpg) e pte4 i/o (port) status0 output (cpg) e pte3 i/o (port) drak1 output (dmac) e pte2 i/o (port) drak0 output (dmac) e pte1 i/o (port) dack1 output (dmac) e pte0 i/o (port) dack0 output (dmac)
rev. 4.00, 03/04, page 461 of 660 port port function (related module) other function (related module) f ptf6 i/o (port) asebrkak output (aud) f ptf5 i/o (port) tdo output (h-udi) f ptf4 i/o (port) audsync output (aud) f ptf3 i/o (port) audata[3] i/o (aud) f ptf2 i/o (port) audata[2] i/o (aud) f ptf1 i/o (port) audata[1] i/o (aud) f ptf0 i/o (port) audata[0] i/o (aud) g ptg5 input (port) adtrg input (adc) g ptg4 input (port) audck input (aud) g ptg3 input (port) trst input (aud)/(h-udi) g ptg2 input (port) tms input (h-udi) g ptg1 input (port) tck input (h-udi) g ptg0 input (port) tdi input (h-udi) h pth6 i/o (port) dreq1 input (dmac) h pth5 i/o (port) dreq0 input (dmac) h pth4 i/o (port) irq4 input (intc) h pth3 i/o (port) irq3 input (intc) / irl3 input (intc) h pth2 i/o (port) irq2 input (intc) / irl2 input (intc) h pth1 i/o (port) irq1 input (intc) / irl1 input (intc) h pth0 i/o (port) irq0 input (intc) / irl0 input (intc) j ptj3 i/o (port) an3 input (adc)/ da0 output (dac) j ptj2 i/o (port) an2 input (adc)/ da1 output (dac) j ptj1 i/o (port) an1 input (adc) j ptj0 i/o (port) an0 input (adc)
rev. 4.00, 03/04, page 462 of 660 port port function (related module) other function (related module) scpt scpt5 input (port) cts2 input (scif)/ irq5 input (intc) scpt scpt4 i/o (port) rts2 output (scif) scpt scpt3 i/o (port) sck2 i/o (scif) scpt2 input (port) rxd2 input (scif) scpt scpt2 output (port) txd2 output (scif) scpt scpt1 i/o (port) sck0 i/o (sci) scpt0 input (port) rxd0 input (sci) scpt scpt0 output (port) txd0 output (sci) notes: scpt0, and scpt2 have the same data register to be accessed although they have different input pins and output pins. 17.1 register description the pin function controller has the following registers. refer to section 23, list of registers, for more details of the addresses and access sizes. ? port a control register (pacr) ? port b control register (pbcr) ? port c control register (pccr) ? port d control register (pdcr) ? port e control register (pecr) ? port f control register (pfcr) ? port g control register (pgcr) ? port h control register (phcr) ? port j control register (pjcr) ? sc port control register (scpcr)
rev. 4.00, 03/04, page 463 of 660 17.1.1 port a control register (pacr) port a control register (pacr) is a 16-bit read/write register that selects the pin functions and the input pull-up mos control. bit bit name initial value r/w description 15 14 pa7md1 pa7md0 0 0 r/w r/w pa7 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 13 12 pa6md1 pa6md0 0 0 r/w r/w pa6 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 11 10 pa5md1 pa5md0 0 0 r/w r/w pa5 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 9 8 pa4md1 pa4md0 0 0 r/w r/w pa4 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 7 6 pa3md1 pa3md0 0 0 r/w r/w pa3 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page 464 of 660 bit bit name initial value r/w description 5 4 pa2md1 pa2md0 0 0 r/w r/w pa2 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 3 2 pa1md1 pa1md0 0 0 r/w r/w pa1 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 1 0 pa0md1 pa0md0 0 0 r/w r/w pa0 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 17.1.2 port b control register (pbcr) port b control register (pbcr) is a 16-bit read/write register that selects the pin functions and the input pull-up mos control. bit bit name initial value r/w description 15 14 pb7md1 pb7md0 0 0 r/w r/w pb7 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 13 12 pb6md1 pb6md0 0 0 r/w r/w pb6 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page 465 of 660 bit bit name initial value r/w description 11 10 pb5md1 pb5md0 0 0 r/w r/w pb5 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 9 8 pb4md1 pb4md0 0 0 r/w r/w pb4 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 7 6 pb3md1 pb3md0 0 0 r/w r/w pb3 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 5 4 pb2md1 pb2md0 0 0 r/w r/w pb2 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 3 2 pb1md1 pb1md0 0 0 r/w r/w pb1 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 1 0 pb0md1 pb0md0 0 0 r/w r/w pb0 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page 466 of 660 17.1.3 port c control register (pccr) port c control register (pccr) is a 16-bit read/write register that selects the pin functions and the input pull-up mos control. bit bit name initial value r/w description 15 14 pc7md1 pc7md0 0 0 r/w r/w pc7 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 13 12 pc6md1 pc6md0 0 0 r/w r/w pc6 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 11 10 pc5md1 pc5md0 0 0 r/w r/w pc5 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 9 8 pc4md1 pc4md0 0 0 r/w r/w pc4 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 7 6 pc3md1 pc3md0 0 0 r/w r/w pc3 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 5 4 pc2md1 pc2md0 0 0 r/w r/w pc2 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page 467 of 660 bit bit name initial value r/w description 3 2 pc1md1 pc1md0 0 0 r/w r/w pc1 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 1 0 pc0md1 pc0md0 0 0 r/w r/w pc0 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 17.1.4 port d control register (pdcr) port d control register (pdcr) is a 16-bit read/write register that selects the pin functions and the input pull-up mos control. bit bit name initial value r/w description 15 14 pd7md1 pd7md0 0 0 r/w r/w pd7 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 13 12 pd6md1 pd6md0 0 0 r/w r/w pd6 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 11 10 pd5md1 pd5md0 0 0 r/w r/w pd5 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page 468 of 660 bit bit name initial value r/w description 9 8 pd4md1 pd4md0 0 0 r/w r/w pd4 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 7 6 pd3md1 pd3md0 0 0 r/w r/w pd3 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 5 4 pd2md1 pd2md0 0 0 r/w r/w pd2 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 3 2 pd1md1 pd1md0 0 0 r/w r/w pd1 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 1 0 pd0md1 pd0md0 0 0 r/w r/w pd0 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page 469 of 660 17.1.5 port e control register (pecr) port e control register (pecr) is a 16-bit read/write register that selects the pin functions and the input pull-up mos control. bit bit name initial value r/w description 15 14 pe7md1 pe7md0 0 0 r/w r/w pe7 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 13 12 pe6md1 pe6md0 0 0 r/w r/w pe6 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 11 10 pe5md1 pe5md0 0 0 r/w r/w pe5 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 9 8 pe4md1 pe4md0 0 0 r/w r/w pe4 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 7 6 pe3md1 pe3md0 0 0 r/w r/w pe3 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 5 4 pe2md1 pe2md0 0 0 r/w r/w pe2 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page 470 of 660 bit bit name initial value r/w description 3 2 pe1md1 pe1md0 0 0 r/w r/w pe1 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 1 0 pe0md1 pe0md0 0 0 r/w r/w pe0 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 17.1.6 port f control register (pfcr) port f control register (pfcr) is a 16-bit read/write register that selects the pin functions and the input pull-up mos control. pfcr is initialized to h'aaaa (in case of asemd0 = 1) or h'0000 (in case of asemd0 = 0) by power-on resets; however, it is not initialized by manual resets, in standby mode, or in sleep mode. bit bit name initial value r/w description 15 ? 1/0 r reserved when asemd0 = 0, this bit is always read as 0 and must only be written with 0. when asemd0 = 1, this bit is always read as 1 and must only be written with 1. 14 ? 0 r reserved this bit is always read as 0 and must only be writtenwith0. 13 12 pf6md1 pf6md0 1/0 0 r/w r/w pf6 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 11 10 pf5md1 pf5md0 1/0 0 r/w r/w pf5 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page 471 of 660 bit bit name initial value r/w description 9 8 pf4md1 pf4md0 1/0 0 r/w r/w pf4 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 7 6 pf3md1 pf3md0 1/0 0 r/w r/w pf3 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 5 4 pf2md1 pf2md0 1/0 0 r/w r/w pf2 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 3 2 pf1md1 pf1md0 1/0 0 r/w r/w pf1 mode 1 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 1 0 pf0md1 pf0md0 1/0 0 r/w r/w pf0 mode 1 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page 472 of 660 17.1.7 port g control register (pgcr) port g control register (pgcr) is a 16-bit read/write register that selects the pin functions and the input pull-up mos control. pgcr is initialized to h'aaaa (in case of asemd0 =1)or h'a800 (in case of asemd0 = 0) by power-on resets; however, it is not initialized by manual resets, in standby mode, or in sleep mode. bit bit name initial value r/w description 15, 13 ? all 1 r reserved these bits are always read as 1. the write value should always be 0. 14, 12 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 11 10 pg5md1 pg5md0 1 0 r/w r/w pg5 mode 00: other function (see table 17.1) 01: reserved (setting prohibited) 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 9 8 pg4md1 pg4md0 1/0 0 r/w r/w pg4 mode 00: other function (see table 17.1) 01: reserved (setting prohibited) 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 7 6 pg3md1 pg3md0 1/0 0 r/w r/w pg3 mode 00: other function (see table 17.1) 01: reserved (setting prohibited) 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 5 4 pg2md1 pg2md0 1/0 0 r/w r/w pg2 mode 00: other function (see table 17.1) 01: reserved (setting prohibited) 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 3 2 pg1md1 pg1md0 1/0 0 r/w r/w pg1 mode 00: other function (see table 17.1) 01: reserved (setting prohibited) 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page 473 of 660 bit bit name initial value r/w description 1 0 pg0md1 pg0md0 1/0 0 r/w r/w pg0 mode 00: other function (see table 17.1) 01: reserved (setting prohibited) 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) note: the bit number are out of sequence. 17.1.8 port h control register (phcr) port h control register (phcr) is a 16-bit read/write register that selects the pin functions and the input pull-up mos control. bit bit name initial value r/w description 15, 14 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 13 12 ph6md1 ph6md0 0 0 r/w r/w ph6 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 11 10 ph5md1 ph5md0 0 0 r/w r/w ph5 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 9 8 ph4md1 ph4md0 0 0 r/w r/w ph4 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 7 6 ph3md1 ph3md0 0 0 r/w r/w ph3 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page 474 of 660 bit bit name initial value r/w description 5 4 ph2md1 ph2md0 0 0 r/w r/w ph2 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 3 2 ph1md1 ph1md0 0 0 r/w r/w ph1 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 1 0 ph0md1 ph0md0 0 0 r/w r/w ph0 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page 475 of 660 17.1.9 port j control register (pjcr) port j control register (pjcr) is a 16-bit read/write register that selects the pin functions. when d/a output is enabled, port input settings should not be made in pjcr. when selecting port input, confirm that d/a output is disabled in dacr before making port input settings in pjcr. bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 6 pj3md1 pj3md0 0 0 r/w r/w pj3 mode 00: other function (see table 17.1) 01: reserved (setting prohibited) 10: port input 11: port input 5 4 pj2md1 pj2md0 0 0 r/w r/w pj2 mode 00: other function (see table 17.1) 01: reserved (setting prohibited) 10: port input 11: port input 3 2 pj1md1 pj1md0 0 0 r/w r/w pj1 mode 00: other function (see table 17.1) 01: reserved (setting prohibited) 10: port input 11: port input 1 0 pj0md1 pj0md0 0 0 r/w r/w pj0 mode 00: other function (see table 17.1) 01: reserved (setting prohibited) 10: port input 11: port input
rev. 4.00, 03/04, page 476 of 660 17.1.10 sc port control register (scpcr) sc port control register (scpcr) is a 16-bit read/write register that selects the pin functions and the input pull-up mos control. the setting of scpcr is valid only when the transmit/receive operation is disabled in the setting of the scscr register. when the te bit in scscr is set to 1, the other function output state has a higher priority than the scpcr setting of the txd2 or txd0 pin. when the re bit in scscr is set to 1, the input state has a higher priority than the scpcr setting of the rxd2 or rxd0 pin. bit bit name initial value r/w description 15 to 12 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 11 10 scp5md1 scp5md0 1 0 r/w r/w scp5 mode 00: other function (see table 17.1) 01: reserved (setting prohibited) 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 9 8 scp4md1 scp4md0 1 0 r/w r/w scp4 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 7 6 scp3md1 scp3md0 1 0 r/w r/w scp3 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off)
rev. 4.00, 03/04, page 477 of 660 bit bit name initial value r/w description 5 4 scp2md1 scp2md0 0 0 r/w r/w scp2 mode 00: transmit data output 1 (txd2) receive data input 1 (rxd2) 01: general output (scpt[2] output pin) receive data input 1 (rxd2) 10: scpt[2] input pin pull-up (input pin) transmit data output 1 (txd2) 11: general input (scpt[2] input pin) transmit data output 1 (txd2) note: there is no combination of simultaneous i/o of scpt[2] because one bit (scp2dt) is accessed using two pins of txd2 and rxd2. when the port input is set (bit scpnmd1 is set to 1) and when the te bit in scscr is set to 1, the txd1 pin is in the output state. when the te bit is cleared to 0, the txd2 pin is in the high-impedance state. 3 2 scp1md1 scp1md0 1 0 r/w r/w scp1 mode 00: other function (see table 17.1) 01: port output 10: port input (pull-up mos: on) 11: port input (pull-up mos: off) 1 0 scp0md1 scp0md0 0 0 r/w r/w scp0 mode 00: transmit data output 0 (txd0) receive data input 0 (rxd0) 01: general output (scpt[0] output pin) receive data input 0 (rxd0) 10: scpt[0] input pin pull-up (input pin) transmit data output 0 (txd0) 11: general input (scpt[0] input pin) transmit data output 0 (txd0) note: there is no combination of simultaneous i/o of scpt[0] because one bit (scp0dt) is accessed using two pins of txd0 and rxd0. when the port input is set (bit scpnmd1 is set to 1) and when the te bit in scscr is set to 1, the txd0 pin is in the output state. when the te bit is cleared to 0, the txd0 pin is in the high-impedance state.
rev. 4.00, 03/04, page 478 of 660
rev. 4.00, 03/04, page 479 of 660 section 18 i/o ports this lsi has 10 ports (ports a to j and sc). all port pins are multiplexed with other pin functions (pin function controller (pfc) maintains the selection of the pin functions and pull-up mos control). each port has a data register which stores the data to the pins. 18.1 port a port a is an 8-bit i/o port with the pin configuration shown in figure 18.1. each pin has an input pull-up mos, which is controlled by port a control register (pacr) in pfc. pta7 (i/o) / d23 (i/o) pta6 (i/o) / d22 (i/o) pta5 (i/o) / d21 (i/o) pta4 (i/o) / d20 (i/o) pta3 (i/o) / d19 (i/o) pta2 (i/o) / d18 (i/o) pta1 (i/o) / d17 (i/o) pta0 (i/o) / d16 (i/o) port a figure 18.1 port a 18.1.1 register description port a has the following register. refer to section 23, list of registers, for more details of the addresses and access sizes. ? port a data register (padr) 18.1.2 port a data register (padr) port a data register (padr) is an 8-bit read/write register that stores data for pins pta7 to pta0. pa7dt to pa0dt bit corresponds to pta7 to pta0 pin. when the pin function is general output port, if the port is read the value of the corresponding padr bit is returned directly. when the function is general input port, if the port is read the corresponding pin level is read.
rev. 4.00, 03/04, page 480 of 660 bit bit name initial value r/w description 7 pa7dt 0 r/w table 18.1 shows the function of padr. 6 pa6dt 0 r/w 5 pa5dt 0 r/w 4 pa4dt 0 r/w 3 pa3dt 0 r/w 2 pa2dt 0 r/w 1 pa1dt 0 r/w 0 pa0dt 0 r/w table 18.1 read/write operation of the port a data register (padr) panmd1 panmd0 pin state read write 0 other function padr value value is written to padr, but does not affect pin state. 0 1 output padr value write value is output from pin. 0 input (pull-up mos on) pin state value is written to padr, but does not affect pin state. 1 1 input (pull-up mos off) pin state value is written to padr, but does not affect pin state. (n = 0 to 7) 18.2 port b port b is an 8-bit i/o port with the pin configuration shown in figure 18.2. each pin has an input pull-up mos, which is controlled by port b control register (pbcr) in pfc. ptb7 (i/o) / d31 (i/o) ptb6 (i/o) / d30 (i/o) ptb5 (i/o) / d29 (i/o) ptb4 (i/o) / d28 (i/o) ptb3 (i/o) / d27 (i/o) ptb2 (i/o) / d26 (i/o) ptb1 (i/o) / d25 (i/o) ptb0 (i/o) / d24 (i/o) port b figure 18.2 port b
rev. 4.00, 03/04, page 481 of 660 18.2.1 register description port b has the following register. refer to section 23, list of registers, for more details of the addresses and access size. ? port b data register (pbdr) 18.2.2 port b data register (pbdr) port b data register (pbdr) is an 8-bit read/write register that stores data for pins ptb7 to ptb0. pb7dt to pb0dt bit corresponds to ptb7 to ptb0 pin. when the pin function is general output port, if the port is read the value of the corresponding pbdr bit is returned directly. when the function is general input port, if the port is read the corresponding pin level is read. bit bit name initial value r/w description 7 pb7dt 0 r/w table 18.2 shows the function of pbdr. 6 pb6dt 0 r/w 5 pb5dt 0 r/w 4 pb4dt 0 r/w 3 pb3dt 0 r/w 2 pb2dt 0 r/w 1 pb1dt 0 r/w 0 pb0dt 0 r/w table 18.2 read/write operation of the port b data register (pbdr) pbnmd1 pbnmd0 pin state read write 0 other function pbdr value value is written to pbdr, but does not affect pin state. 0 1 output pbdr value write value is output from pin. 0 input (pull-up mos on) pin state value is written to pbdr, but does not affect pin state. 1 1 input (pull-up mos off) pin state value is written to pbdr, but does not affect pin state. (n = 0 to 7)
rev. 4.00, 03/04, page 482 of 660 18.3 port c port c is an 8-bit i/o port with the pin configuration shown in figure 18.3. each pin has an input pull-up mos, which is controlled by port c control register (pccr) in pfc. ptc7 (i/o) / (output) / (output) ptc6 (i/o) / (output) / (output) ptc5 (i/o) / (output) ptc4 (i/o) / (output) ptc3 (i/o) / (output) ptc2 (i/o) / (output) / (output) / (output) ptc1 (i/o) / (output) / (output) / (output) ptc0 (i/o) / (output) port c figure 18.3 port c 18.3.1 register description port c has the following register. refer to section 23, list of registers, for more details of the addresses and access sizes. ? port c data register (pcdr) 18.3.2 port c data register (pcdr) port c data register (pcdr) is an 8-bit read/write register that stores data for pins ptc7 to ptc0. pc7dt to pc0dt bit corresponds to ptc7 to ptc0 pin. when the pin function is general output port, if the port is read, the value of the corresponding pcdr bit is returned directly. when the function is general input port, if the port is read, the corresponding pin level is read. table 18.3 shows the function of pcdr. pcdr is initialized to h'00 by a power-on reset. it retains its previous value in standby mode and sleep mode, and in a manual reset.
rev. 4.00, 03/04, page 483 of 660 bit bit name initial value r/w description 7 pc7dt 0 r/w table 18.3 shows the function of pcdr. 6 pc6dt 0 r/w 5 pc5dt 0 r/w 4 pc4dt 0 r/w 3 pc3dt 0 r/w 2 pc2dt 0 r/w 1 pc1dt 0 r/w 0 pc0dt 0 r/w table 18.3 read/write operation of the port c data register (pcdr) pcnmd1 pcnmd0 pin state read write 0 other function pcdr value value is written to pcdr, but does not affect pin state. 0 1 output pcdr value write value is output from pin. 0 input (pull-up mos: on) pin state value is written to pcdr, but does not affect pin state. 1 1 input (pull-up mos: off) pin state value is written to pcdr, but does not affect pin state. (n = 0 to 7) 18.4 port d port d is an 8-bit i/o port with the pin configuration shown in figure 18.4. each pin has an input pull-up mos, which is controlled by port d control register (pdcr) in pfc. ptd7 (i/o) / (output) ptd6 (i/o) / (output) ptd5 (i/o) / (input) ptd4 (i/o) / cke (output) ptd3 (i/o) / (output) ptd2 (i/o) / (output) ptd1 (i/o) / (output) ptd0 (i/o) / (output) port d figure 18.4 port d
rev. 4.00, 03/04, page 484 of 660 18.4.1 register description port d has the following register. refer to section 23, list of registers, for more details of the addresses and access sizes. ? port d data register (pddr) 18.4.2 port d data register (pddr) port d data register (pddr) is an 8-bit read/write register that stores data for pins ptd7 to ptd0. pd7dt to pd0dt bit corresponds to ptd7 to ptd0 pin. when the pin function is general output port, if the port is read, the value of the corresponding pddr bit is returned directly. when the function is general input port, if the port is read, the corresponding pin level is read. pddr is initialized to h'00 by a power-on reset. it retains its previous value in standby mode and sleep mode, and in a manual reset. bit bit name initial value r/w description 7 pd7dt 0 r/w table 18.4 shows the function of pddr. 6 pd6dt 0 r/w 5 pd5dt 0 r/w 4 pd4dt 0 r/w 3 pd3dt 0 r/w 2 pd2dt 0 r/w 1 pd1dt 0 r/w 0 pd0dt 0 r/w table 18.4 read/write operation of the port d data register (pddr) pdnmd1 pdnmd0 pin state read write 0 other function pddr value value is written to pddr, but does not affect pin state. 0 1 output pddr value write value is output from pin. 0 input (pull-up mos: on) pin state value is written to pddr, but does not affect pin state. 1 1 input (pull-up mos: off) pin state value is written to pddr, but does not affect pin state. (n = 0 to 7)
rev. 4.00, 03/04, page 485 of 660 18.5 port e port e is an 8-bit i/o port with the pin configuration shown in figure 18.5. each pin has an input pull-up mos, which is controlled by port e control register (pecr) in pfc. pte7 (i/o) / (output) pte6 (i/o) / tclk (i/o) pte5 (i/o) / status1 (output) pte4 (i/o) / status0 (output) pte3 (i/o) / drak1 (output) pte2 (i/o) / drak0 (output) pte1 (i/o) / (output) pte0 (i/o) / (output) port e figure 18.5 port e 18.5.1 register description port e has the following register. refer to section 23, list of registers, for more details of the addresses and access sizes. ? port e data register (pedr) 18.5.2 port e data register (pedr) port e data register (pedr) is an 8-bit read/write register that stores data for pins pte7 to pte0. pe7dt to pe0dt bit corresponds to pte7 to pte0 pin. when the pin function is general output port, if the port is read the value of the corresponding pedr bit is returned directly. when the function is general input port, if the port is read the corresponding pin level is read. pedr is initialized to h'00 by a power-on reset, after which the general input port function (pull- up mos on) is set as the initial pin function, and the corresponding pin levels are read. it retains its previous value in standby mode and sleep mode, and in a manual reset.
rev. 4.00, 03/04, page 486 of 660 bit bit name initial value r/w description 7 pe7dt 0 r/w table 18.5 shows the function of pedr. 6 pe6dt 0 r/w 5 pe5dt 0 r/w 4 pe4dt 0 r/w 3 pe3dt 0 r/w 2 pe2dt 0 r/w 1 pe1dt 0 r/w 0 pe0dt 0 r/w table 18.5 read/write operation of the port e data register (pedr) penmd1 penmd0 pin state read write 0 other function pedr value value is written to pedr, but does not affect pin state. 0 1 output pedr value write value is output from pin. 0 input (pull-up mos: on) pin state value is written to pedr, but does not affect pin state. 1 1 input (pull-up mos: off) pin state value is written to pedr, but does not affect pin state. (n = 0 to 7) 18.6 port f port f is a 7-bit input/output port with the pin configuration shown in figure 18.6. each pin has an input pull-up mos, which is controlled by port f control register (pfcr) in pfc. ptf6 (i/o) / (output) ptf5 (i/o) / tdo (output) ptf4 (i/o) / audsync (output) ptf3 (i/o) / audata3 (i/o) ptf2 (i/o) / audata2 (i/o) ptf1 (i/o) / audata1 (i/o) ptf0 (i/o) / audata0 (i/o) port f figure 18.6 port f
rev. 4.00, 03/04, page 487 of 660 18.6.1 register description port f has the following register. refer to section 23, list of registers, for more details of the addresses and access sizes. ? port f data register (pfdr) 18.6.2 port f data register (pfdr) port f data register (pfdr) is an 8-bit register composed of a 1-bit readable register and a 7-bit readable/writable register. this register stores data for pins ptf6 to ptf0. pf6dt to pf0dt bit corresponds to ptf6 to ptf0 pin. when the function is general input port, if the port is read the corresponding pin level is read. pfdr is initialized by a power-on reset, after which the general input port function (pull-up mos on) is set as the initial pin function, and the corresponding pin levels are read. it retains its previous value in standby mode and sleep mode, and in a manual reset. bit bit name initial value r/w description 7 ? 0rreserved 6 pf6dt 0 r/w table 18.6 shows the function of pfdr. 5pf5dt0 r/w 4pf4dt0 r/w 3pf3dt0 r/w 2pf2dt0 r/w 1pf1dt0 r/w 0pf0dt0 r/w table 18.6 read/write operation of the port f data register (pfdr) pfnmd1 pfnmd0 pin state read write 0 other functions pfdr value can be written to pfdr but does not affect the pin state. 0 1 output pfdr value a value to be written is output from the pin. 0 input (pull-up mos: on) pin state can be written to pfdr but does not affect the pin state. 1 1 input (pull-up mos: off) pin state can be written to pfdr but does not affect the pin state. (n = 0 to 6)
rev. 4.00, 03/04, page 488 of 660 18.7 port g port g is a 6-bit input port with the pin configuration shown in figure 18.7. each pin has an input pull-up mos, which is controlled by port g control register (pgcr) in pfc. ptg5 (input) / (input) ptg4 (input) / audck (input) ptg3 (input) / (input) ptg2 (input) / tms (input) ptg1 (input) / tck (input) ptg0 (input) / tdi (input) port g figure 18.7 port g 18.7.1 register description port g has the following register. refer to section 23, list of registers, for more details of the addresses and access sizes. ? port g data register (pgdr) 18.7.2 port g data register (pgdr) port g data register (pgdr) is an 8-bit read register that stores data for pins ptg5 to ptg0. pg5dt to pg0dt bit corresponds to ptg5 to ptg0 pin. when the function is general input port, if the port is read the corresponding pin level is read. pgdr is initialized by a power-on reset, after which the general input port function (pull-up mos on) is set as the initial pin function, and the corresponding pin levels are read. it retains its previous value in standby mode and sleep mode, and in a manual reset.
rev. 4.00, 03/04, page 489 of 660 bit bit name initial value r/w description 7 ? * r reserved 6 ? * r 5pg5dt * r table 18.7 shows the function of pgdr. 4pg4dt * r 3pg3dt * r 2pg2dt * r 1pg1dt * r 0pg0dt * r note: * undefined table 18.7 read/write operation of the port g data register (pgdr) pgnmd1 pgnmd0 pin state read write 0 other function low level ignored (no affect on pin state) 0 1 reserved ? ignored (no affect on pin state) 0 input (pull-up mos: on) pin state ignored (no affect on pin state) 1 1 input (pull-up mos: off) pin state ignored (no affect on pin state) (n = 0 to 5) 18.8 port h port h is a 7-bit i/o and port with the pin configuration shown in figure 18.8. each pin has an input pull-up mos, which is controlled by port h control register (phcr) in pfc. port h pth6 (i/o) / (input) pth5 (i/o) / (input) pth4 (i/o) / irq4 (input) pth3 (i/o) / irq3 (input) / (input) pth2 (i/o) / irq2 (input) / (input) pth1 (i/o) / irq1 (input) / (input) pth0 (i/o) / irq0 (input) / (input) figure 18.8 port h
rev. 4.00, 03/04, page 490 of 660 18.8.1 register description port h has the following register. refer to section 23, list of registers, for more details of the addresses and access sizes. ? port h data register (phdr) 18.8.2 port h data register (phdr) port h data register (phdr) is a 7-bit read/write and 1-bit read register that stores data for pins pth6 to pth0. ph6dt to ph0dt bit corresponds to pth6 to pth0 pin. when the pin function is general output port, if the port is read, the value of the corresponding phdr bit is returned directly. when the function is general input port, if the port is read, the corresponding pin level is read. phdr is initialized to h'00 by a power-on reset. it retains its previous value in standby mode and sleep mode, and in a manual reset. note that the low level is read if bits 6 to 0 are read except in general-purpose input. bit bit name initial value r/w description 7 ? * r reserved 6 ph6dt 0 r/w table 18.8 shows the function of phdr. 5 ph5dt 0 r/w 4 ph4dt 0 r/w 3 ph3dt 0 r/w 2 ph2dt 0 r/w 1 ph1dt 0 r/w 0 ph0dt 0 r/w note: * undefined
rev. 4.00, 03/04, page 491 of 660 table 18.8 read/write operation of the port h data register (phdr) phnmd1 phnmd0 pin state read write 0 other function phdr value value is written to phdr, but does not affect pin state. 0 1 output phdr value write value is output from pin. 0 input (pull-up mos: on) pin state value is written to phdr, but does not affect pin state. 1 1 input (pull-up mos: off) pin state value is written to phdr, but does not affect pin state. (n = 0 to 6) 18.9 port j port j is a 4-bit input port with the pin configuration shown in figure 18.9. ptj3 (input) / an3 (input) / da0 (output) ptj2 (input) / an2 (input) / da1 (output) ptj1 (input) / an1 (input) ptj0 (input) / an0 (input) port j figure 18.9 port j 18.9.1 register description port j has the following register. refer to section 23, list of registers, for more details of the addresses and access sizes. ? port j data register (pjdr)
rev. 4.00, 03/04, page 492 of 660 18.9.2 port j data register (pjdr) port j data register (pjdr) is an 8-bit read register that stores data for pins ptj7 to ptj0. pj3dt to pj0dt bit corresponds to ptj3 to ptj0 pin. when the pin function is general output port, if the port is read the value of the corresponding pjdr bit is returned directly. when the function is general input port, if the port is read, the corresponding pin level is read. bit bit name initial value r/w description 7 ? 0rreserved 6 ? 0r 5 ? 0r 4 ? 0r 3 pj3dt 0 r table 18.9 shows the function of pjdr. 2pj2dt0 r 1pj1dt0 r 0pj0dt0 r table 18.9 read/write operation of the port j data register (pjdr) pjnmd1 pjnmd0 pin state read write 0 other function low level ignored (no affect on pin state) 0 1 reserved (setting prohibited) ? ignored (no affect on pin state) 0 input pin state ignored (no affect on pin state) 1 1 input pin state ignored (no affect on pin state) (n = 0 to 3)
rev. 4.00, 03/04, page 493 of 660 18.10 sc port sc port is a 3-bit i/o, 2-bit output and 4-bit input port with the pin configuration shown in figure 18.10. each pin has an input pull-up mos, which is controlled by sc port control register (scpcr) in pfc. scpt5 (input) / (input) / irq5 (input) scpt4 (i/o) / (output) scpt3 (i/o) / sck2 (i/o) scpt2 (input) / rxd2 (input) scpt2 (output) / txd2 (output) scpt1 (i/o) / sck0 (i/o) scpt0 (input) / rxd0 (input) scpt0 (output) / txd0 (output) sc port figure 18.10 sc port 18.10.1 register description port sc has the following register. refer to section 23, list of registers, for more details of the addresses and access sizes. ? sc port data register (scpdr) 18.10.2 sc port data register (scpdr) sc port data register (scpdr) is a 5-bit read/write and 3-bit read register that stores data for pins scpt5 to scpt0. scp5dt to scp0dt bit corresponds to scpt5 to scpt0 pin. when the pin function is general output port, if the port is read, the value of the corresponding scpdr bit is returned directly. when the function is general input port, if the port is read, the corresponding pin level is read. scpdr is initialized to b'***00000 by a power-on reset. after initialization, the general input port function (pull-up mos on) is set as the initial pin function, and the corresponding pin levels are read from bits scp5dt to scp3dt and scp1dt. scpdr retains its previous value in standby mode and sleep mode, and in a manual reset. note that the low level is read if bit 7 is read except in general-purpose input. when reading the state of the rxd2 and rxd0 pins of the scp2dt and scp0dt bits in scpdr without clearing the te or re bit in scscr to 0, set the re bit in scscr to 1. when the re bit is set to 1, the rxd pin is for input and the pin state can be read before the setting of scpcr.
rev. 4.00, 03/04, page 494 of 660 bit bit name initial value r/w description 7 ? * r reserved 6 ? * r 5scp5dt * r table 18.10 shows the function of scpdr 4 scp4dt 0 r/w 3 scp3dt 0 r/w 2 scp2dt 0 r/w 1 scp1dt 0 r/w 0 scp0dt 0 r/w note: * undefined table 18.10 read/write operation of the sc port data register (scpdr) ? for scp4dt to scp0dt scpnmd1 scpnmd0 pin state read write 0 other function scpdr value value is written to scpdr, but does not affect pin state. 0 1 output scpdr value write value is output from pin. 0 input (pull-up mos: on) pin state value is written to scpdr, but does not affect pin state. 1 1 input (pull-up mos: off) pin state value is written to scpdr, but does not affect pin state. (n = 0 to 4) ? for scp5dt scpnmd1 scpnmd0 pin state read write 0 other function low level ignored (no affect on pin state) 0 1 reserved (setting prohibited) ? ignored (no affect on pin state) 0 input (pull-up mos: on) pin state ignored (no affect on pin state) 1 1 input (pull-up mos: off) pin state ignored (no affect on pin state) (n = 5)
rev. 4.00, 03/04, page 495 of 660 section 19 a/d converter (adc) this lsi includes a 10-bit successive-approximation a/d converter with a selection of up to four analog input channels. figure 19.1 shows the block diagram of the a/d converter. 19.1 features a/d converter features are listed below. ? 10-bit resolution ? 4 input channels ? high-speed conversion ? conversion time: minimum 15 s per channel (with p = 33-mhz peripheral clock) ? three conversion modes ? single mode: a/d conversion of one channel ? multi mode: a/d conversion on one to four channels ? scan mode: continuous a/d conversion on one to four channels ? four 16-bit data registers ? a/d conversion results are transferred for storage into data registers corresponding to the channels. ? sample-and-hold function ? a/d conversion can be externally triggered ? a/d interrupt requested at the end of conversion ? at the end of a/d conversion, an a/d end interrupt (adi) can be requested.
rev. 4.00, 03/04, page 496 of 660 10-bit d/a addra addrb addrd bus interface peripheral data bus analog multi- plexer control circuit successive approxi- mation register + ? comparator sample-and- hold circuit adi interrupt signal av ss an 0 an 1 an 2 an 3 /4 /8 adcsr adcr av cc a/d converter legend: adcr: a/d control register adcsr: a/d control/status register addra: a/d data register a addrb: a/d data register b addrc: a/d data register c addrd: a/d data register d internal data bus addrc figure 19.1 a/d converter block diagram
rev. 4.00, 03/04, page 497 of 660 19.2 input/output pin table 19.1 summarizes the a/d converter's input pins. av cc and av ss are the power supply for the analog circuits in the a/d converter. avcc also functions as the a/d converter reference voltage. table 19.1 a/d converter pins pin name abbreviation i/o function analog power-supply pin avcc input analog power supply analog ground pin avss input analog ground and reference voltage analog input pin 0 an0 input analog input pin 1 an1 input analog input pin 2 an2 input analog input pin 3 an3 input group 0 analog inputs a/d external trigger input pin adtrg input external trigger input for starting a/d conversion 19.3 register description the a/d converter has the following registers. refer to section 23, list of registers, for more details of the addresses and access sizes. ? a/d data register a (addra) the upper and lower bytes of addra may be represented by addrah and addral, respectively. ? a/d data register b(addrb) the upper and lower bytes of addrb may be represented by addrbh and addrbl, respectively. ? a/d data register c (addrc) the upper and lower bytes of addrc may be represented by addrch and addrcl, respectively. ? a/d data register d (addrd) the upper and lower bytes of addrd may be represented by addrdh and addrdl, respectively. ? a/d control/status register (adcsr) ? a/d control register (adcr)
rev. 4.00, 03/04, page 498 of 660 19.3.1 a/d data registers a to d (addra to addrd) the four a/d data registers (addra to addrd) are 16-bit read-only registers that store the results of a/d conversion. an a/d conversion produces 10-bit data, which is transferred for storage into the a/d data register corresponding to the selected channel. the upper 8 bits of the result are stored in the upper byte (bits 15 to 8) of the a/d data register. the lower 2 bits are stored in the lower byte (bits 7 and 6). bits 5 to 0 of an a/d data register are reserved bits that always read 0. for the reading of the data, see section 19.4, bus master interface, and section 19.9.3, access size and read data. table 19.2 indicates the pairings of analog input channels and a/d data registers. bit bit name initial value r/w description 15 to 6 ad9 to ad0 all 0 r bit data (10 bits) 5to0 ? all 0 r reserved these bits are always read as 0. table 19.2 analog input channels and a/d data registers analog input channel group 0 a/d data register an0 addra an1 addrb an2 addrc an3 addrd
rev. 4.00, 03/04, page 499 of 660 19.3.2 a/d control/status register (adcsr) adcsr is an 8-bit read/write register that selects the mode and controls the a/d converter. bit bit name initial value r/w description 7adf 0 r/(w) * 1 a/d end flag indicates the end of a/d conversion. 0: [clearing conditions] 1. cleared by reading adf while adf = 1, then writing 0 in adf 2. cleared when dmac is activated by adi interrupt and addr is read 1: [setting conditions] 1. single mode: a/d conversion ends 2. multi mode: a/d conversion ends in all selected channels 3. scan mode: a/d conversion ends in all selected channels. 6 adie 0 r/w a/d interrupt enable enables or disables the interrupt (adi) requested at the end of a/d conversion. set the adie when convertion is stopped. 0: a/d end interrupt request (adi) is disabled 1: a/d end interrupt request (adi) is enabled 5 adst 0 r/w a/d start starts or stops a/d conversion. the adst bit remains set to 1 during a/d conversion. it can also be set to 1 by external trigger input at the adtrg pin. 0: a/d conversion is stopped 1: 1. single mode: a/d conversion starts; adst is automatically cleared to 0 when conversion ends. 2. multi mode: a/d conversion stauts: adst is automatically cleard to 0 when conversion ends in all selected channels. 3. scan mode: a/d conversion starts and continues, cycling among the selected channels, until adst is cleared to 0 by software reset, or by a transition to standby mode.
rev. 4.00, 03/04, page 500 of 660 bit bit name initial value r/w description 4 multi 0 r/w multi mode selects single mode, multi mode or scan mode. for further information on operation in these modes, see section 19.6, operation. the mode is selected by the combination of this bit (multi) and bit 5 (scn) of adcr. multi scn 0 0 : single mode 0 1 : single mode 1 0 : multi mode 11:scanmode 3 cks 0 r/w clock select selects the a/d conversion time. clear the adst bit to 0 before switching the conversion time. 0: conversion time = 536 states (maximum) 1: conversion time = 266 states (maximum) * 2 2 1 0 ch2 ch1 ch0 0 0 0 r/w r/w r/w channel select these bits and the multi bit select the analog input channels. clear the adst bit to 0 before changing the channel selection. single mode multi mode and scan (multi = 0) mode (multi = 1) 000: an0 an0 001: an1 an0, an1 010: an2 an0 to an2 011: an3 an0 to an3 notes: 1. only 0 can be written to clear the flag. 2. the cks value should be set so that the a/d conversion time is 16 s (minimum).
rev. 4.00, 03/04, page 501 of 660 19.3.3 a/d control register (adcr) adcr is an 8-bit read/write register that enables or disables external triggering of a/d conversion. adcr is initialized to h'07 by a reset and in standby mode. bit bit name initial value r/w description 7 6 trge1 trge0 0 0 r/w r/w trigger enable enables or disables external triggering of a/d conversion. 00: when an external trigger is input, the a/d conversion does not start 01: the same as above 10: the same as above 11: the a/d conversion starts at the falling edge of an input signal from the external trigger pin ( adtrg ). 5 scn 0 r/w scan mode selects multi mode or scan mode when the multi bit is set to 1. see the description of bit 4 in 19.3.2, a/d control/status register (adcsr). 4, 3 ? all 0 r/w reserved these bits are always read as 0. the write value should always be 0. 2to0 ? all1 r reserved these bits are always read as 1. the write value should always be 0. 19.4 bus master interface addra to addrd are 16-bit registers, but they are connected to the bus master by the upper 8 bits of the 16-bit peripheral data bus. therefore, although the upper byte can be accessed directly by the bus master, the lower byte is read through an 8-bit temporary register (temp). an a/d data register is read as follows. when the upper byte is read, the upper-byte value is transferred directly to the bus master and the lower-byte value is transferred into temp. next, when the lower byte is read, the temp contents are transferred to the bus master. when reading an a/d data register, always read the upper byte before the lower byte. it is possible to read only the upper byte, but if only the lower byte is read, the read value is not guaranteed.
rev. 4.00, 03/04, page 502 of 660 figure 19.2 shows the data flow for access to an a/d data register. bus interface temp (h'40) lower byte of a/d data register (h'40) upper byte of a/d data register (h'aa) cpu (h'aa) upper byte read module internal data bus bus interface temp (h'40) cpu (h'40) lower byte read module internal data bus lower byte of a/d data register (h'40) upper byte of a/d data register (h'aa) figure 19.2 a/d data register access operation (reading h'aa40)
rev. 4.00, 03/04, page 503 of 660 19.5 access size of a/d data register 19.5.1 word access when a/d data registers (addra to addrd) are read in word, a/d data register values are read from bits 15 to 8, and invalid data is read from bits 7 to 0. figure 19.3 shows an example of reading addrah. addrah invalid data 15 8 7 0 figure 19.3 word access example 19.5.2 longword access when a/d data registers are read in longword, the upper byte of the a/d data register is read from bits 31 to 24, invalid data from bits 23 to 16, the lower byte of the a/d data register from bits 15 to 8, and invalid data from bits 7 to 0. figure 19.4 shows an example of reading addrah. addrah invalid data invalid data 31 24 23 16 addral 15 8 7 0 figure 19.4 longword access example 19.6 operation the a/d converter operates by successive approximations with 10-bit resolution. it has two operating modes: single mode and scan mode. 19.6.1 single mode (multi = 0) single mode should be selected when only one a/d conversion on one channel is required. a/d conversion starts when the adst bit in adcsr is set to 1 by software, or by external trigger input. the adst bit remains set to 1 during a/d conversion and is automatically cleared to 0 when conversion ends. when conversion ends the adf bit is set to 1. if the adie bit is also set to 1, an adi interrupt is requested at this time. to clear the adf flag to 0, first read adcsr, then write 0 in adf.
rev. 4.00, 03/04, page 504 of 660 when the mode or analog input channel must be switched during a/d conversion, to prevent incorrect operation, first clear the adst bit to 0 in adcsr to halt a/d conversion. after making the necessary changes, set the adst bit to 1 to start a/d conversion again. the adst bit can be set at the same time as the mode or channel is changed. typical operations when channel 1 (an1) is selected in single mode are described next. figure 19.5 shows a timing diagram for this example. 1. single mode is selected (multi = 0), input channel an1 is selected (ch2 = ch1 = 0, ch0 = 1), the a/d interrupt is enabled (adie = 1), and a/d conversion is started (adst = 1). 2. when a/d conversion is completed, the result is transferred into addrb. at the same time the adf flag is set to 1, the adst bit is cleared to 0, and the a/d converter becomes idle. 3. since adf = 1 and adie = 1, an adi interrupt is requested. 4. the a/d interrupt processing routine starts. 5. the routine reads adcsr, then writes 0 in the adf flag. 6. the routine reads and processes the conversion result (addrb = 0). 7. execution of the a/d interrupt processing routine ends. then, when the adst bit is set to 1, a/dconversionstartstoexecute2to7above. channel 0 (an0) operating adie adst adf channel 1 (an1) operating channel 2 (an2) operating channel 3 (an3) operating addra addrb addrc addrd waiting waiting waiting waiting waiting waiting a/d conversion starts set * set * set * clear * clear a/d conversion result 1 a/d conversion result 2 read result read result a/d conversion 1 a/d conversion result 2 note: * downward arrows ( figure 19.5 example of a/d converter operation (single mode, channel 1 selected)
rev. 4.00, 03/04, page 505 of 660 19.6.2 multi mode (multi = 1, scn = 0) multi mode should be selected when performing multi channel a/d conversions on one or more channels. when the adst bit in adcsr is set to 1 by software or external trigger input, a/d conversion starts on the first channel in the group (an0 when ch2 = 0). when two or more channels are selected, after conversion of the first channel ends, conversion of the second channel (an1) starts immediately. when a/d conversions end on the selected channels, the adst bit is cleared to 0. the conversion results are transferred for storage into the a/d data registers corresponding to the channels. when the mode or analog input channel selection must be changed during a/d conversion, to prevent incorrect operation, first clear the adst bit to 0 in adcsr to halt a/d conversion. after making the necessary changes, set the adst bit to 1. a/d conversion will start again from the first channel in the group. the adst bit can be set at the same time as the mode or channel selection is changed. typical operations when three channels in group 0 (an0 to an2) are selected in scan mode are described next. figure 19.6 shows a timing diagram for this example. 1. multi mode is selected (multi = 1, scn = 0), channel group 0 is selected (ch2 = 0), analog input channels an0 to an2 are selected (ch1 = 1, ch0 = 0), and a/d conversion is started (adst = 1). 2. when a/d conversion of the first channel (an0) is completed, the result is transferred into addra. next, conversion of the second channel (an1) starts automatically. 3. conversion proceeds in the same way through the third channel (an2). 4. when conversion of all selected channels (an0 to an2) is completed, the adf flag is set to 1 and adst bit is cleared to 0. if the adie bit is set to 1, an adi interrupt is requested at this time. when the adst bit is cleared to 0, a/d conversion stops. after that, if the adst bit is set to 1, a/d conversion starts again from the first channel (an0).
rev. 4.00, 03/04, page 506 of 660 channel 0 (an0) operating adst adf channel 1 (an1) operating channel 2 (an2) operating channel 3 (an3) operating addra addrb addrc addrd waiting waiting waiting waiting set * clear * clear * a/d conversion result 2 waiting waiting a/d conversion result 3 a/d conversion 1 waiting a/d conversion result 1 transfer a/d conversion 3 a/d conversion a/d conversion 2 note: * downward arrows ( figure 19.6 example of a/d converter operation (multi mode, channels an0 to an2 selected) 19.6.3 scan mode (multi = 1, scn = 1) scan mode is useful for monitoring analog inputs in a group of one or more channels. when the adst bit in the adcsr is set to 1 by software or external trigger input, a/d conversion starts on the first channel in the group (an0 when ch2 = 0). when two or more channels are selected, after conversion of the first channel ends, conversion of the second channel (an1) starts immediately. a/d conversion continues cyclically on the selected channels until the adst bit is cleared to 0. the conversion results are transferred for storage into the addra to addrd corresponding to the channels. when the mode or analog input channel must be changed during analog conversion, to prevent incorrect operation, first clear the adst bit to 0 to halt a/d conversion. after making the necessary changes, set the adst bit to 1. a/d conversion will start again from the first channel in the group. the adst bit can be set at the same time as the mode or channel selection is changed. typical operations when three channels (an0 to an2) are selected in scan mode are described next. figure 19.7 shows a timing diagram for this example.
rev. 4.00, 03/04, page 507 of 660 1. scan mode is selected (multi = 1, scn = 1), channel group 0 is selected (ch2 = 0), analog input channels an0 to an2 are selected (ch1 = 1, ch0 = 0), and a/d conversion is started (adst = 1). 2. when a/d conversion of the first channel (an0) is completed, the result is transferred into addra. next, conversion of the second channel (an1) starts automatically. 3. conversion proceeds in the same way through the third channel (an2). 4. when conversion of all the selected channels (an0 to an2) is completed, the adf flag is set to 1 and conversion of the first channel (an0) starts again. if the adie bit is set to 1, an adi interrupt is requested at this time. 5. steps 2 to 4 are repeated as long as the adst bit remains set to 1. when the adst bit is cleared to 0, a/d conversion stops. after that, if the adst bit is set to 1, a/d conversion starts again from the first channel (an0). adst adf channel 0 (an 0 ) operating channel 1 (an 1 ) operating channel 2 (an 2 ) operating channel 3 (an 3 ) operating addra * 2 addrb * 2 addrc * 2 addrd * 2 waiting waiting waiting waiting waiting waiting waiting waiting waiting transfer a/d conversion 1 a/d conversion 4 a/d conversion 2 a/d conversion 3 a/d conversion result 1 a/d conversion result 4 a/d conversion result 2 a/d conversion result 3 clear * 1 clear * 1 set * 1 continuous a/d conversion a/d conversion 5 notes: 1. downward arrows indicate instruction executed by software. 2. data is ignored during conversion. figure 19.7 example of a/d converter operation (scan mode, channels an0 to an2 selected)
rev. 4.00, 03/04, page 508 of 660 19.6.4 input sampling and a/d conversion time the a/d converter has a built-in sample-and-hold circuit. the a/d converter samples the analog inputatatimet d after the adst bit in adcsr is set to 1, then starts conversion. figure 19.8 shows the a/d conversion timing. table 19.3 indicates the a/d conversion time. as indicated in figure 19.8, the a/d conversion time includes t d and the input sampling time. the length of t d varies depending on the timing of the write access to adcsr. the total conversion time therefore varies within the ranges indicated in table 19.3. in multi mode and scan mode, the values given in table 19.3 apply to the first conversion. in the second and subsequent conversions the conversion time is fixed at 512 states when cks = 0 or 256 states when cks = 1. p figure 19.8 a/d conversion timing
rev. 4.00, 03/04, page 509 of 660 table 19.3 a/d conversion time (single mode) cks = 0 cks = 1 symbol min typ max min typ max a/d conversion start delay t d 17?2810? 17 input sampling time t spl ?129??65? a/d conversion time t conv 514 ? 525 259 ? 266 note: values in the table are numbers of states (t cyc ). 19.6.5 external trigger input timing a/d conversion can be externally triggered. when the trge1, trge0 bits in adcr are set to 1. external trigger input is enabled at the adtrg pin. a high-to-low transition at the adtrg pin sets the adst bit in adcsr to 1, starting a/d conversion. other operations, regardless of the conversion mode, are the same as if the adst bit had been set to 1 by software. figure 19.9 shows the timing. a/d conversion p figure 19.9 external trigger input timing 19.7 interrupt requests the a/d converter generates an interrupt (adi) at the end of a/d conversion. the adi interrupt request can be enabled or disabled by the adie bit in adcsr.
rev. 4.00, 03/04, page 510 of 660 19.8 definitions of a/d conversion accuracy the a/d converter compares an analog value input from an analog input channel to its analog reference value and converts it into 10-bit digital data. the absolute accuracy of this a/d conversion is the deviation between the input analog value and the output digital value. it includes the following errors: ? offset error ? full-scale error ? quantization error ? nonlinearity error these four error quantities are explained below using figure 19.10. in the figure, the 10 bits of the a/d converter have been simplified to 3 bits. offset error is the deviation between actual and ideal a/d conversion characteristics when the digital output value changes from the minimum (zero voltage) 0000000000 (000 in the figure) to 000000001 (001 in the figure) (figure 19.10, item (1)). full-scale error is the deviation between actual and ideal a/d conversion characteristics when the digital output value changes from the 1111111110 (110 in the figure) to the maximum 1111111111 (111 in the figure) (figure 19.10, item (2)). quantization error is the intrinsic error of the a/d converter and is expressed as 1/2 lsb (figure 19.10, item (3)). nonlinearity error is the deviation between actual and ideal a/d conversion characteristics between zero voltage and full-scale voltage (figure 19.10, item (4)). note that it does not include offset, full-scale or quantization error. 111 110 101 100 011 010 001 000 0 1/8 2/8 3/8 4/8 5/8 6/8 7/8 fs analog input voltage fs: full-scale voltage (3) quantization error ideal a/d conversion characteristics (4) nonlinearity error ideal a/d conversion characteristics actual a/d convertion characteristics (2) full-scale error digital output analog input voltage (1) offset error fs digital output figure 19.10 definitions of a/d conversion accuracy
rev. 4.00, 03/04, page 511 of 660 19.9 usage note when using the a/d converter, note the points listed in section 19.7.1 below. 19.9.1 setting analog input voltage ? analog input voltage range: during a/d conversion, the voltages input to the analog input pins ann should be in the range av ss ann av cc (n = 0 to 3). ? av cc ,av ss , input voltage: av cc and av ss should be related as follows: av cc =v cc q 0.2vandav ss =v ss . 19.9.2 processing of analog input pins to prevent damage from voltage surges at the analog input pins (an0 to an3), connect an input protection circuit like the one shown in figure 19.11. the circuit shown also includes an rc filter to suppress noise. this circuit is shown as an example; the circuit constants should be selected according to actual application conditions. table 19.4 lists the analog input pin specifications and figure 19.12 shows an equivalent circuit diagram of the analog input ports. 0.01 ? figure 19.11 example of analog input protection circuit 1.0 k ? ? figure 19.12 analog input pin equivalent circuit
rev. 4.00, 03/04, page 512 of 660 table 19.4 analog input pin ratings item min max unit analog input capacitance ? 20 pf allowable signal-source impedance ? 5 k ? 19.9.3 access size and read data table 19.5 shows the relationship between access size and read data. note the read data obtained with different access sizes, bus widths, and endian modes. the case is shown here in which h'3ff is obtained when av cc is input as an analog input. ff is the data containing the upper 8 bits of the conversion result, and c0 is the data containing the lower 2 bits. table 19.5 relationship between access size and read data bus width 32 bits (d31 to d0) 16 bits (d15 to d0) 8 bits (d7 to d0) access size command endian big little big little big little byte access mov.l mov.b mov.l mov.b #addrah,r9 @r9,r8 #addral,r9 @r9,r8 ffffffff c0c0c0c0 ffffffff c0c0c0c0 ffff c0c0 ffff c0c0 ff c0 ff c0 word access mov.l mov.w mov.l mov.w #addrah,r9 @r9,r8 #addral,r9 @r9,r8 ffxxffxx c0xxc0xx ffxxffxx c0xxc0xx ffxx c0xx ffxx c0xx ffxx c0xx xxff xxc0 longword access mov.l mov.l #addrah,r9 @r9,r8 ffxxc0xx ffxxc0xx ffxxc0xx c0xxffxx ffxxc0xx xxc0xxff note: #addrah .equ h'a4000080 #addral .equ h'a4000082 values are shown in hexadecimal for the case where read data is output to an external device via r8.
rev. 4.00, 03/04, page 513 of 660 section 20 d/a converter (dac) this lsi includes a d/a converter with two channels. figure 20.1 shows a block diagram of the d/a converter. av cc da 0 da 1 dacr dadr0 dadr1 module data bus bus interface on-chip data bus control circuit 8-bit d/a av ss legend dacr: dadr0: dadr1: d/a control register d/a data register 0 d/a data register 1 figure 20.1 d/a converter block diagram 20.1 feature d/a converter features are listed below. ? 8-bit resolution ? two output channels ? conversion time: maximum 10 s (with 20-pf capacitive load) ? output voltage: 0 v to avcc
rev. 4.00, 03/04, page 514 of 660 20.2 input/output pin table 20.1 summarizes the d/a converter's input and output pins. table 20.1 d/a converter pins pin name abbreviation i/o function analog power-supply pin avcc input analog power supply analog ground pin avss input analog ground and reference voltage analog output pin 0 da0 output analog output, channel 0 analog output pin 1 da1 output analog output, channel 1 20.3 register description the d/a converter has the following registers. refer to section 23, list of registers, for more details of the addresses and access sizes. ? d/a data register 0 (dadr0) ? d/a data register 1 (dadr1) ? d/a control register (dacr) 20.3.1 d/a data registers 0 and 1 (dadr0 and dadr1) the d/a data registers (dadr0 and dadr1) are 8-bit read/write registers that store the data to be converted. when analog output is enabled, the d/a data register values are constantly converted and output at the analog output pins. the d/a data registers are initialized to h'00 by a reset.
rev. 4.00, 03/04, page 515 of 660 20.3.2 d/a control register (dacr) dacr is an 8-bit read/write register that controls the operation of the d/a converter. bit bit name initial value r/w description 7 daoe1 0 r/w d/a output enable 1 controls d/a conversion and analog output. 0: da1 analog output is disabled 1: channel-1 d/a conversion and da1 analog output are enabled 6 daoe0 0 r/w d/a output enable 0 controls d/a conversion and analog output. 0: da0 analog output is disabled 1: channel-0 d/a conversion and da0 analog output are enabled 5 dae 0 r/w d/a enable controls d/a conversion, together with bits daoe0 and daoe1. when the dae bit is cleared to 0, d/a conversion is controlled independently in channels 0 and 1. when this lsi enters standby mode while d/a conversion is enabled, the d/a output is held and the analog power-supply current is equivalent to that during d/a conversion. to reduce the analog power- supply current in standby mode, clear the daoe0 and daoe1 bits and disable the d/a output. 00 : d/a conversion is disabled in channels 0 and 1 010: d/a conversion is enabled in channel 0 d/a conversion is disabled in channel 1 011: d/a conversion is enabled in channels 0 and 1 100: d/a conversion is disabled in channel 0 d/a conversion is enabled in channel 1 101: d/a conversion is enabled in channels 0 and 1 11 : d/a conversion is enabled in channels 0 and 1 when the dae bit is set to 1, even if bits daoe0 and daoe1 in dacr and the adst bit in adcsr are cleared to 0, the same current is drawn from the analog power supply as during a/d and d/a conversion. 4to0 ? all1 r reserved these bits are always read as 1. the write value should always be 1. note: : don?t care
rev. 4.00, 03/04, page 516 of 660 20.4 operation the d/a converter has two built-in d/a conversion circuits that can perform conversion independently. d/a conversion is performed constantly while enabled in dacr. if the dadr0 or dadr1 value is modified, conversion of the new data begins immediately. the conversion results are output whenbitsdaoe0anddaoe1aresetto1. an example of d/a conversion on channel 0 is given next. timing is indicated in figure 20.2. 1. data to be converted is written in dadr0. 2. bit daoe0 is set to 1 in dacr. d/a conversion starts and da0 becomes an output pin. the converted result is output after the conversion time. the output value is (dadr0 contents/256) avcc. output of this conversion result continues until the value in dadr0 is modified or the daoe0 bit is cleared to 0. 3. if the dadr0 value is modified, conversion starts immediately, and the result is output after the conversion time. 4. when the daoe0 bit is cleared to 0, da0 becomes an input pin. dadr0 write cycle t dconv high-impedance state conversion result 1 conversion data 1 conversion data 2 conversion result 2 t dconv address bus dadr0 daoe0 da0 t dconv : d/a conversion time dacr write cycle dadr0 write cycle dacr write cycle legend figure 20.2 example of d/a converter operation
rev. 4.00, 03/04, page 517 of 660 section 21 user debugging interface (h-udi) the h-udi (user debugging interface) performs on-chip debugging which is supported by the sh7706. the h-udi described here is a serial interface which is pi-compatible with jtag (joint test action group, ieee standard 1149.1 and ieee standard test access port and boundary- scan architecture) specifications. the h-udi in the sh7706 supports a boundary scan mode, and is also used for emulator connection. when using an emulator, h-udi functions should not be used. refer to the emulator manual for the method of connecting the emulator. figure 21.1 shows the block diagram of the h-udi. sdir tck tdo tdi tms trst sdbpr mux sdbsr shift register tap controller decoder local bus figure 21.1 h-udi block diagram
rev. 4.00, 03/04, page 518 of 660 21.1 feature the h-udi has the following features. ? support of the e10a emulator ? standard pin arrangement of jtag ? real-time branch trace ? 1-kbyte on-chip ram for running the high-speed emulation program 21.2 input/output pin table 21.1 lists the pin configuration of the h-udi. table 21.1 pin configuraiton name description tck h-udi serial data input/output clock pin. data is serially supplied to the h-udi from the data input pin (tdi), and output from the data output pin (tdo), in synchronization with this clock. tms mode select input pin. the state of the tap control circuit is determined by changing this signal in synchronization with tck. the protocol conforms to the jtag standard (ieee std. 1149.1). trst h-udi reset input pin. input is accepted asynchronously with respect to tck, and when low, the h-udi is reset. see section 21.4.2, reset configuration, for more information. tdi h-udi serial data input pin. data transfer to the h-udi is executed by changing this signal in synchronization with tck. tdo h-udi serial data output pin. data output from the h-udi is executed by reading this signal in synchronization with tck. asemd0 ase mode select pin. if a low level is input at the asemd0 pin while the resetp pin is asserted, ase mode is entered; if a high level is input, normal operation mode is entered. asemd0 pin should be high level when an emulator or h-udi is not used. in ase mode, boundary scan and emulator functions can be used. the input level at the asemd0 pin should be held for at least one cycle after resetp negation. asebrkak dedicated emulator pin
rev. 4.00, 03/04, page 519 of 660 21.3 register description the h-udi has the following registers. refer to section 23, list of registers, for more details of the addresses and access sizes. ? bypass register (sdbpr) ? instruction register (sdir) ? boundary register (sdbsr) 21.3.1 bypass register (sdbpr) the bypass register is a 1-bit register that cannot be accessed by the cpu. when the sdir is set to the bypass mode, the sdbpr is connected between h-udi pins tdi and tdo. 21.3.2 instruction register (sdir) the instruction register (sdir) is a 16-bit read-only register. the register is in bypass mode in its initial state. it is initialized by trst or in the tap test-logic-reset state, and can be written by the h-udi irrespective of the cpu mode. operation is not guaranteed when a reserved command is set to this register. bit bit name initial value r/w description 15 14 13 12 ti3 ti2 ti1 ti0 1 1 1 1 r r r r test instruction bits cannot be written by the cpu. 0000: extest 0100: sample/preload 0101: reserved (setting prohibited) 0110: h-udi reset negate 0111: h-udi reset assert 100x: reserved (setting prohibited) 101x: h-udi interrupt 110x: reserved (setting prohibited) 1110: reserved (setting prohibited) 1111: bypass mode (initial value) 0001: recovery from sleep 11 to 0 ? all 1 r reserved these bits are always read as 1. note: x don't care
rev. 4.00, 03/04, page 520 of 660 21.3.3 boundary scan register (sdbsr) the boundary scan register (sdbsr) is a shift register, located on the pad, for controlling the input/output pins of this lsi. using the extest and sample/preload commands, a boundary scan test conforming to the jtag standard can be carried out. table 21.2 shows the correspondence between this lsi's pins and boundary scan register bits. table 21.2 this lsi's pins and boundary scan register bits bit pin name i/o bit pin name i/o from tdi 272 d6 in 297 d31/ptb[7] in 271 d5 in 296 d30/ptb[6] in 270 d4 in 295 d29/ptb[5] in 269 d3 in 294 d28/ptb[4] in 268 d2 in 293 d27/ptb[3] in 267 d1 in 292 d26/ptb[2] in 266 d0 in 291 d25/ptb[1] in 265 d31/ptb[7] out 290 d24/ptb[0] in 264 d30/ptb[6] out 289 d23/pta[7] in 263 d29/ptb[5] out 288 d22/pta[6] in 262 d28/ptb[4] out 287 d21/pta[5] in 261 d27/ptb[3] out 286 d20/pta[4] in 260 d26/ptb[2] out 285 d19/pta[3] in 259 d25/ptb[1] out 284 d18/pta[2] in 258 d24/ptb[0] out 283 d17/pta[1] in 257 d23/pta[7] out 282 d16/pta[0] in 256 d22/pta[6] out 281 d15 in 255 d21/pta[5] out 280 d14 in 254 d20/pta[4] out 279 d13 in 253 d19/pta[3] out 278 d12 in 252 d18/pta[2] out 277 d11 in 251 d17/pta[1] out 276 d10 in 250 d16/pta[0] out 275 d9 in 249 d15 out 274 d8 in 248 d14 out 273 d7 in 247 d13 out
rev. 4.00, 03/04, page 521 of 660 bit pin name i/o bit pin name i/o 246 d12 out 212 d10 control 245 d11 out 211 d9 control 244 d10 out 210 d8 control 243 d9 out 209 d7 control 242 d8 out 208 d6 control 241 d7 out 207 d5 control 240 d6 out 206 d4 control 239 d5 out 205 d3 control 238 d4 out 204 d2 control 237 d3 out 203 d1 control 236 d2 out 202 d0 control 235 d1 out 201 bs /ptc[0] in 234 d0 out 200 we2 / dqmul / iciord /ptc[1] in 233 d31/ptb[7] control 199 we3 / dqmuu / iciowr /ptc[2] in 232 d30/ptb[6] control 198 cs2 /ptc[3] in 231 d29/ptb[5] control 197 cs3 /ptc[4] in 230 d28/ptb[4] control 196 a0 out 229 d27/ptb[3] control 195 a1 out 228 d26/ptb[2] control 194 a2 out 227 d25/ptb[1] control 193 a3 out 226 d24/ptb[0] control 192 a4 out 225 d23/pta[7] control 191 a5 out 224 d22/pta[6] control 190 a6 out 223 d21/pta[5] control 189 a7 out 222 d20/pta[4] control 188 a8 out 221 d19/pta[3] control 187 a9 out 220 d18/pta[2] control 186 a10 out 219 d17/pta[1] control 185 a11 out 218 d16/pta[0] control 184 a12 out 217 d15 control 183 a13 out 216 d14 control 182 a14 out 215 d13 control 181 a15 out 214 d12 control 180 a16 out 213 d11 control 179 a17 out
rev. 4.00, 03/04, page 522 of 660 bit pin name i/o bit pin name i/o 178 a18 out 148 a12 control 177 a19 out 147 a13 control 176 a20 out 146 a14 control 175 a21 out 145 a15 control 174 a22 out 144 a16 control 173 a23 out 143 a17 control 172 a24 out 142 a18 control 171 a25 out 141 a19 control 170 bs /ptc[0] out 140 a20 control 169 rd out 139 a21 control 168 we0 / dqmll out 138 a22 control 167 we1 / dqmlu / we out 137 a23 control 166 we2 / dqmul / iciord /ptc[1] out 136 a24 control 165 we3 / dqmuu / iciowr /ptc[2] out 135 a25 control 164 rd/ wr out 134 bs /ptc[0] control 163 cs0 out 133 rd control 162 cs2 /ptc[3] out 132 we0 / dqmll control 161 cs3 /ptc[4] out 131 we1 / dqmlu / we control 160 a0 control 130 we2 / dqmul / iciord /ptc[1] control 159 a1 control 129 we3 / dqmuu / iciowr /ptc[2] control 158 a2 control 128 rd/ wr control 157 a3 control 127 cs0 control 156 a4 control 126 cs2 /ptc[3] control 155 a5 control 125 cs3 /ptc[4] control 154 a6 control 124 cs4 /ptc[5] in 153 a7 control 123 cs5 / ce1a /ptc[6] in 152 a8 control 122 cs6 / ce1b /ptc[7] in 151 a9 control 121 ce2a /ptd[6] in 150 a10 control 120 ce2b /ptd[7] in 149 a11 control 119 rasl /ptd[0] in
rev. 4.00, 03/04, page 523 of 660 bit pin name i/o bit pin name i/o 118 rasu /ptd[1] in 88 dack0/pte[0] out 117 casl /ptd[2] in 87 dack1/pte[1] out 116 casu /ptd[3] in 86 drak0/pte[2] out 115 cke/ptd[4] in 85 drak1/ptte[3] out 114 iois16 /ptd[5] in 84 audata[0]/ptf[0] out 113 breq in 83 audata[1]/ptf[1] out 112 wait in 82 audata[2]/ptf[2] out 111 dack0/pte[0] in 81 audata[3]/ptf[3] out 110 dack1/pte[1] in 80 audsync /ptf[4] out 109 drak0/pte[2] in 79 asebrkak /ptf[6] out 108 drak1/pte[3] in 78 cs4 /ptc[5] control 107 audata[0]/ptf[0] in 77 cs5 / ce1a /ptc[6] control 106 audata[1]/ptf[1] in 76 cs6 / ce1b /ptc[7] control 105 audata[2]/ptf[2] in 75 ce2a /ptd[6] control 104 audata[3]/ptf[3] in 74 ce2b /ptd[7] control 103 audsync /ptf[4] in 73 rasl /ptd[0] control 102 asebrkak /ptf[6] in 72 rasu /ptd[1] control 101 md1 in 71 casl /ptd[2] control 100 cs4 /ptc[5] out 70 casu /ptd[3] control 99 cs5 / ce1a /ptc[6] out 69 cke/ptd[4] control 98 cs6 / ce1b /ptc[7] out 68 iois16 /ptd[5] control 97 ce2a /ptd[6] out 67 back control 96 ce2b /ptd[7] out 66 dack0 /pte[0] control 95 rasl /ptd[0] out 65 dack1 /pte[1] control 94 rasu /ptd[1] out 64 drak0/pte[2] control 93 casl /ptd[2] out 63 drak1/ptte[3] control 92 casu /ptd[3] out 62 audata[0]/ptf[0] control 91 cke/ptd[4] out 61 audata[1]/ptf[1] control 90 iois16 /ptd[5] out 60 audata[2]/ptf[2] control 89 back out 59 audata[3]/ptf[3] control
rev. 4.00, 03/04, page 524 of 660 bit pin name i/o bit pin name i/o 58 audsync /ptf[4] control 28 irqout /pte[7] out 57 asebrkak /ptf[6] control 27 txd0/scpt[0] out 56 status0/pte[4] in 26 sck0/scpt[1] out 55 status1/pte[5] in 25 txd2/scpt[2] out 54 tclk/pte[6] in 24 sck2/scpt[3] out 53 irqout /pte[7] in 23 rts2 /scpt[4] out 52 sck0/scpt[1] in 22 irq0/ irl0 /pth[0] out 51 sck2 /scpt[3] in 21 irq1/ irl1 /pth[1] out 50 rts2 /scpt[4] in 20 irq2/ irl2 /pth[2] out 49 rxd0/scpt[0] in 19 irq3/ irl3 /pth[3] out 48 rxd2/scpt[2] in 18 irq4/pth[4] out 47 cts2 /irq5/scpt[5] in 17 dreq0 /pth[5] out 46 irq0/ irl0 /pth[0] in 16 dreq1 /pth[6] out 45 irq1/ irl1 /pth[1] in 15 status0/pte[4] control 44 irq2/ irl2 /pth[2] in 14 status1/pte[5] control 43 irq3/ irl3 /pth[3] in 13 tclk/pte[6] control 42 irq4/pth[4] in 12 irqout /pte[7] control 41 nmi in 11 txd0/scpt[0] control 40 audck/ptg[4] in 10 sck0/scpt[1] control 39 dreq0 /pth[5] in 9 txd2/scpt[2] control 38 dreq1 /pth[6] in 8 sck2/scpt[3] control 37 adtrg /ptg[5] in 7 rts2 /scpt[4] control 36 md0 in 6 irq0/ irl0 /pth[0] control 35 md2 in 5 irq1/ irl1 /pth[1] control 34 md3 in 4 irq2/ irl2 /pth[2] control 33 md4 in 3 irq3/ irl3 /pth[3] control 32 md5 in 2 irq4/pth[4] control 31 status0/pte[4] out 1 dreq0 /pth[5] control 30 status1/pte[5] out 0 dreq1 /pth[6] control 29 tclk/pte[6] out to tdo
rev. 4.00, 03/04, page 525 of 660 21.4 h-udi operations 21.4.1 tap controller figure 21.2 shows the internal states of tap controller. state transitions basically conform with the jtag standard. test-logic-reset capture-dr shift-dr exit1-dr pause-dr exit2-dr update-dr select-dr-scan run-test/idle 1 0 0 0 0 11 1 1 0 0 1 11 0 1 1 10 capture-ir shift-ir exit1-ir pause-ir exit2-ir update-ir select-ir-scan 0 0 1 0 0 0 1 0 1 1 10 0 figure 21.2 tap controller state transitions note: the transition condition is the tms value on the rising edge of tck. the tdi value is sampled on the rising edge of tck; shifting occurs on the falling edge of tck. the tdo value changes on the tck falling edge. the tdo is at high impedance, except with shift- dr (shift-sr) and shift-ir states. when trst = 0, there is a transition to test-logic-reset asynchronously with tck.
rev. 4.00, 03/04, page 526 of 660 21.4.2 reset configuration table 21.3 reset configuration asdmd0 asdmd0 asdmd0 asdmd0 * 1 resetp resetp resetp resetp trst trst trst trst chip state l normal reset and h-udi reset l h normal reset l h-udi reset only h h h normal operation l reset hold * 2 l h during ase user mode * 3 : normal reset during ase break mode * 3 : resetp assert is masked l h-udi reset only l h h normal operation notes: 1. performs normal operation mode and ase mode settings asemd0 = h, normal operation mode asemd0 = l, ase mode asemd0 pin should be high level when an emulator or h-udi is not used. 2. during ase mode, reset hold is enabled by setting resetp and trst pins at low level for a constant cycle. in this state, the cpu does not start up, even if resetp is set to high level. when trst is set to high level, h-udi operation is enabled, but the cpu does not start up. the reset hold state is cancelled by the following:  boot request from h-udi (boot sequence)  another resetp assert (power-on reset) 3. ase mode can be divided by two modes: a mode to execute the firmware program of the emulator (ase break mode) and a mode to execute the user program (ase user mode).
rev. 4.00, 03/04, page 527 of 660 21.4.3 h-udi reset an h-udi reset is executed by setting an h-udi reset assert command in sdir. an h-udi reset is of the same kind as a power-on reset. an h-udi reset is released by inputting an h-udi reset negate command. the interval required between the h-udi reset assert command and the h-udi reset negate command is the same as the time for which the resetp pin is held low in order to execute a power-on reset. h-udi reset assert h-udi reset negate sdir chip internal reset cpu state branch to h'a0000000 figure 21.3 h-udi reset 21.4.4 h-udi interrupt the h-udi interrupt function generates an interrupt by setting a command from the h-udi in the sdir. an h-udi interrupt is a general exception/interrupt operation, resulting in a branch to an address based on the vbr value plus offset, and return by the rte instruction. this interrupt request has a fixed priority level of 15. h-udi interrupts are not accepted in sleep mode or standby mode. 21.4.5 bypass the jtag-based bypass mode for the h-udi pins can be selected by setting a command from the h-udi in the sdir. 21.4.6 using h-udi to recover from sleep mode it is possible to recover from sleep mode by setting a command (0001) from the h-udi in sdir.
rev. 4.00, 03/04, page 528 of 660 21.5 boundary scan a command can be set in sdir by the h-udi to place the h-udi pins in the boundary scan mode stipulated by jtag. 21.5.1 supported instructions this lsi supports the three essential instructions defined in the jtag standard (bypass, sample/preload, and extest). bypass: the bypass instruction is an essential standard instruction that operates the bypass register. this instruction shortens the shift path to speed up serial data transfer involving other chips on the printed circuit board. while this instruction is executing, the test circuit has no effect on the system circuits. the instruction code is 1111. sample/preload: the sample/preload instruction inputs values from this lsi's internal circuitry to the boundary scan register, outputs values from the scan path, and loads data onto the scan path. when this instruction is executing, this lsi's input pin signals are transmitted directly to the internal circuitry, and internal circuit values are directly output externally from the output pins. this lsi's system circuits are not affected by execution of this instruction. the instruction code is 0100. in a sample operation, a snapshot of a value to be transferred from an input pin to the internal circuitry, or a value to be transferred from the internal circuitry to an output pin, is latched into the boundary scan register and read from the scan path. snapshot latching is performed in synchronization with the rise of tck in the capture-dr state. snapshot latching does not affect normal operation of this lsi. in a preload operation, an initial value is set in the parallel output latch of the boundary scan register from the scan path prior to the extest instruction. without a preload operation, when the extest instruction was executed an undefined value would be output from the output pin until completion of the initial scan sequence (transfer to the output latch) (with the extest instruction, the parallel output latch value is constantly output to the output pin). extest: this instruction is provided to test external circuitry when this lsi is mounted on a printed circuit board. when this instruction is executed, output pins are used to output test data (previously set by the sample/preload instruction) from the boundary scan register to the printed circuit board, and input pins are used to latch test results into the boundary scan register from the printed circuit board. if testing is carried out by using the extest instruction n times, the nth test data is scanned-in when test data (n-1) is scanned out.
rev. 4.00, 03/04, page 529 of 660 data loaded into the output pin boundary scan register in the capture-dr state is not used for external circuit testing (it is replaced by a shift operation). the instruction code is 0000. 21.5.2 notes for boundary scan 1. boundary scan mode does not cover clock-related signals (extal, extal2, xtal, xtal2, ckio). 2. boundary scan mode does not cover reset-related signals ( resetp , resetm ,ca). 3. boundary scan mode does not cover h-udi-related signals (tck, tdi, tdo, tms, trst). 4. when a boundary scan test is carried out, ensure that the ckio clock operates constantly. the ckio frequency range is as follows: minimum: 1 mhz maximum: maximum frequency for respective clock mode specified in the cpg section set pins md[2:0] to the clock mode to be used. after powering on, wait for the ckio clock to stabilize before performing a boundary scan test. 5. fix the resetp pin low. 6. fix the ca pin high, and the asemd0 pin low. 21.6 usage note 1. an h-udi command other than an h-udi interrupt, once set, will not be modified as long as another command is not re-issued from the h-udi. an h-udi interrupt command, however, will be changed to a bypass command once set. 2. because chip operations are suspended in standby mode, h-udi commands are not accepted. however, the tap controller remains in operation at this time. 3. the h-udi is used for emulator connection. therefore, h-udi functions cannot be used when usinganemulator. 21.7 advanced user debugger (aud) the aud is a function exclusively for use by an emulator. refer to the user's manual for the relevant emulator for details of the aud.
rev. 4.00, 03/04, page 530 of 660
rev. 4.00, 03/04, page 531 of 660 section 22 power-down modes in the power-down modes, all cpu and some on-chip supporting module functions are halted. this lowers power consumption. the sh7706 has four power-down modes: 1. sleep mode 2. software standby mode 3. module standby function (tmu, rtc, sci, ubc, dmac, dac, adc, and scif on-chip supporting modules) 4. hardware standby mode table 22.1 shows the transition conditions for entering the modes from the program execution state, as well as the cpu and supporting module states in each mode and the procedures for canceling each mode. table 22.1 power-down modes state mode transition conditions cpg cpu cpu reg- ister on-chip memory on-chip peripheral modules pins external memory canceling procedure sleep mode execute sleep instruction with stby bit cleared to0instbcr runs halts held held runs held refresh 1. interrupt 2. reset software standby mode execute sleep instruction with stby bit set to 1 in stbcr halts halts held held halts * 1 held self- refresh 1. interrupt 2. reset module standby function set mstp bit of stbcr to 1 runs runs * 4 held held specified module halts * 2 refresh 1. clear mstp bit to 0 2. power-on reset hardware standby mode drive ca pin low halts halts held held halts * 3 held self- refresh power-on reset notes: 1. the rtc still runs if the start bit in rcr2 is set to 1 (see section 13, realtime clock (rtc)). tmu still runs when output of the rtc is used as input to its counter (see section 12, timer unit (tmu)). 2. depends on the on-chip supporting module. tmu external pin: held sci external pin: reset 3. the rtc still runs if the start bit in rcr2 is set to 1. tmu does not run. 4. when the lsi enters sleep mode, the cpu halts.
rev. 4.00, 03/04, page 532 of 660 22.1 input/output pin table 22.2 lists the pins used for the power-down modes. table 22.2 pin configuration pin name symbol i/o description processing state 1 status1 processing state 0 status0 o operating state of the processor. status1 status0 state high-level high-level reset high-level low-level sleep mode low-level high-level standby mode low-level low-level normal operation 22.2 register description these are two control registers for the power-down modes. refer to section 23, list of registers, for more details of the addresses and access sizes. ? standby control register (stbcr) ? standby control register 2 (stbcr2) 22.2.1 standby control register (stbcr) the standby control register (stbcr) is an 8-bit read/write register that sets the power-down mode. bit bit name initial value r/w description 7 stby 0 r/w software standby specifies transition to software standby mode. 0: executing sleep instruction puts the chip into sleep mode. 1: executing sleep instruction puts the chip into software standby mode. 6, 5 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
rev. 4.00, 03/04, page 533 of 660 bit bit name initial value r/w description 4 stbxtl 0 r/w standby crystal specifies whether the crystal oscillator halts or oscillates in standby mode. 0: halts the oscillation of the crystal oscillator in standby mode. 1: continues the oscillation of the crystal oscillator even in standby mode. 3? 0 rreserved these bits are always read as 0. the write value should always be 0. 2 mstp2 0 r/w module stop 2 specifies halting the clock supply to the timer unit tmu (an on-chip supporting module). when the mstp2 bit is set to 1, the supply of the clock to the tmu is halted. 0: tmu runs. 1: clock supply to tmu is halted. 1 mstp1 0 r/w module stop 1 specifies halting the clock supply to the realtime clock rtc (an on-chip supporting module). when the mstp1 bit is set to 1, the supply of the clock to rtc is halted. when the clock halts, all rtc registers become inaccessible, but the counter keeps running. 0: rtc runs. 1: clock supply to rtc is halted. 0 mstp0 0 r/w module stop 0 specifies halting the clock supply to the serial communication interface sci (an on-chip supporting module). when the mstp0 bit is set to 1, the supply of the clock to the sci is halted. 0: sci operates. 1: clock supply to sci is halted.
rev. 4.00, 03/04, page 534 of 660 22.2.2 standby control register 2 (stbcr2) the standby control register 2 (stbcr2) is a read/write 8-bit register that sets the power-down mode. bit bit name initial value r/w description 7? 0 rreserved this bit is always read as 0. the write value should always be 0. 6 mdchg 0 r/w pin md5 to md0 control specifies whether or not pins md5 to md0 are changed in software standby mode. when this bit is set to 1, the md5 to md0 pin values are latched when returning from software standby mode by means of a reset or interrupt. 0: pins md5 to md0 are not changed in software standby mode 1: pins md5 to md0 are changed in software standby mode 5 mstp8 0 r/w module stop 8 specifies halting the clock supply to the user break controller ubc (an on-chip supporting module). when the mstp8 bit is set to 1, the supply of the clock to the ubc is halted. 0: ubc runs 1: clock supply to ubc is halted 4 mstp7 0 r/w module stop 7 specifies halting of clock supply to the dmac (an on-chip peripheral module). when the mstp7 bit is set to 1, the supply of the clock to the dmac is halted. 0: dmac runs 1: clock supply to dmac halted 3 mstp6 0 r/w module stop 6 specifies halting of clock supply to the dac (an on-chip peripheral module). when the mstp6 bit is set to 1, the supply of the clock to the dac is halted. 0: dac runs 1: clock supply to dac halted
rev. 4.00, 03/04, page 535 of 660 bit bit name initial value r/w description 2 mstp5 0 r/w module stop 5 specifies halting of clock supply to the adc (an on-chip peripheral module). when the mstp5 bit is set to 1, the supply of the clock to the adc is halted and all registers are initialized. 0: adc runs 1: clock supply to adc halted and all registers initialized 1 mstp4 0 r/w module stop 4 specifies halting the clock supply to the serial communication interface with fifo (an on-chip peripheral module). when the mstp1 bit is set to 1, the supply of the clock to the scif is halted. 0: scif runs 1: clock supply to scif halted 0? 0 rreserved this bit is always read as 0. the write value should always be 0. 22.3 operation 22.3.1 sleep mode ? transition to sleep mode executing the sleep instruction when the stby bit in stbcr is 0 causes a transition from the program execution state to sleep mode. although the cpu halts immediately after executing the sleep instruction, the contents of its internal registers remain unchanged. the on-chip supporting modules continue to run during sleep mode and the clock continues to be output to the ckio pin. in sleep mode, the status1 pin is set high and the status0 pin low. ? canceling sleep mode sleep mode is canceled by an interrupt (nmi, irq, irl, on-chip supporting module) or reset. interrupts are accepted during sleep mode even when the bl bit in the sr register is 1. if necessary, save spc and ssr in the stack before executing the sleep instruction. canceling with an interrupt: when an nmi, irq, irl or on-chip supporting module interrupt occurs, sleep mode is canceled and interrupt exception processing is executed. a code indicating the interrupt source is set in the intevt and intevt2 registers. canceling with a reset: sleep mode is canceled by a power-on reset or a manual reset.
rev. 4.00, 03/04, page 536 of 660 22.3.2 software standby mode ? transition to software standby mode to enter standby mode, set the stby bit to 1 in stbcr, then execute the sleep instruction. the chip moves from the program execution state to software standby mode. in software standby mode, power consumption is greatly reduced by halting not only the cpu, but the clock and on- chip supporting modules as well. the clock output from the ckio pin also halts. cpu and cache register contents are held, but some on-chip supporting modules are initialized. table 22.3 lists the states of registers in software standby mode. table 22.3 register states in software standby mode module registers initialized registers retaining data interrupt controller (intc) ? all registers on-chip clock pulse generator (cpg) ?allregisters user break controller (ubc) ? all registers bus state controller (bsc) ? all registers timer unit (tmu) tstr register registers other than tstr realtime clock (rtc) ? all registers a/d converter (adc) all registers ? d/a converter (dac) ? all registers the procedure for moving to software standby mode is as follows: 1. clear the tme bit in the wdt's timer control register (wtcsr) to 0 to stop the wdt. set the wdt's timer counter (wtcnt) and the cks2 to cks0 bits of the wtcsr register to appropriate values to secure the specified oscillation settling time. 2. after the stby bit in the stbcr register is set to 1, a sleep instruction is executed. 3. software standby mode is entered and the clocks within the chip are halted. the status1 pin output goes low and the status0 pin output goes high.
rev. 4.00, 03/04, page 537 of 660 ? canceling software standby mode standby mode is canceled by an interrupt (nmi, irq* 1 ,irl* 1 , or on-chip supporting module)* 2 or a reset. canceling with an interrupt: the on-chip wdt can be used for hot starts. when the chip detects an nmi, irl* 1 ,irq* 1 , or on-chip supporting module (except the interval timer)* 2 interrupt, the clock will be supplied to the entire chip and software standby mode canceled after the time set in the wdt's timer control/status register has elapsed. the status1 and status0 pins both go low. interrupt processing then begins and a code indicating the interrupt source is set in the intevt and intevt2 registers. after branching to the interrupt processing routine occurs, clear the stby bit in the stbcr register. the wtcnt stops automatically. if the stby bit is not cleared, wtcnt continues operation and transits to the standby mode* 3 when it reaches h'80. this function prevents the data from being destroyed due to a rising voltage under an unstable power supply. interrupts are accepted during software standby mode even when the bl bit in the sr register is 1. if necessary, save spc and ssr in the stack before executing the sleep instruction. immediately after an interrupt is detected, the phase of the clock output of the ckio pin may be unstable, until the processor starts interrupt processing. (the canceling condition is that the irl3 to irl0 level is higher than the mask level in the i3 to i0 bits in the sr register.) notes: 1. software standby mode can be canceled using irl3 to irl0 or irq4 to irq0. 2. software standby mode can be canceled with an rtc or tmu (only when running on the rtc clock) interrupt. 3. standby mode should be canceled by power-on resets. operations at manual resets or during interrupt input are not guaranted. wtcnt value h'ff h'80 time interrupt request wdt overflow and branch to interrupt handling routine crystal oscillator settling time and pll synchronization time clear bit stbcr.stby before wtcnt reaches h'80. when stbcr.stby is cleared, wtcnt halts automatically. figure 22.1 canceling software standby mode with stbcr.stby
rev. 4.00, 03/04, page 538 of 660 canceling with a reset: standby mode can be canceled with a reset (power-on or manual). keep the resetp pin and resetm pin low until the clock oscillation settles. ? clock pause function in software standby mode, the clock input from the extal pin or ckio pin can be halted and the frequency can be changed. this function is used as follows: 1. enter software standby mode using the appropriate procedures. 2. once software standby mode is entered and the clock stopped within the chip, the status1 pin output is low and the status0 pin output is high. 3. once the status1 pin goes low and the status0 pin goes high, the input clock is stopped or the frequency is changed. 4. when the frequency is changed, an nmi, irl , irq or on-chip supporting module (except the internal timer) interrupt is input after the change. when the clock is stopped, the same interrupts are input after the clock is applied. 5. after the time set in the wdt has elapsed, the clock starts being applied internally within the chip, the status1 and status0 pins both go low, interrupts are handled, and operation resumes.
rev. 4.00, 03/04, page 539 of 660 22.3.3 module standby function ? transition to module standby function setting the standby control register mstp8 to mstp4, mstp2 to mstp0 bits to 1 halts the supply of clocks to the corresponding on-chip supporting modules. this function can be used to reduce the power consumption in normal mode and sleep mode. the module standby function holds the state prior to halt of the external pins of the on-chip supporting modules. tmu external pins hold their state prior to the halt. sci external pins go to the reset state. with a few exceptions, all registers hold their values. bit value description 0 ubc runs. mstp8 1 supply of clock to ubc halted. 0 dmac runs. mstp7 1 supply of clock to dmac halted. 0 dac runs. mstp6 1 supply of clock to dac halted. 0 adc runs. mstp5 1 supply of clock to adc halted, and all registers initialized. 0 scif runs. mstp4 1 supply of clock to scif halted. 0 tmu runs. mstp2 1 supply of clock to tmu halted. registers initialized. * 1 0 rtc runs. mstp1 1 supply of clock to rtc halted. register access prohibited. * 2 0 sci runs. mstp0 1 supply of clock to sci halted. notes: 1. the registers initialized are the same as in the software standby mode (table 22.3). 2. the counter runs. ? clearing the module standby function the module standby function can be cleared by clearing the mstp8 to mstp4, mstp2 to mstp0 bits to 0, or by a power-on reset or manual reset.
rev. 4.00, 03/04, page 540 of 660 22.3.4 timing of status pin changes the timing of status1 and status0 pin changes is shown in figures 22.2 through 22.9 ? timing for resets power-on reset: ckio status normal * 2 normal * 2 reset * 1 pll settling time 0 to 5 bcyc * 3 0 to 30 bcyc * 3 notes: 1. reset: hh (status1 high, status0 high) 2. normal: ll (status1 low, status0 low) 3. bcyc: bus clock cycle figure 22.2 power-on reset status output manual reset: ckio * 1 status normal * 3 normal * 3 reset * 2 0 bcyc or more * 4 0 to 30 bcyc * 4 notes: 1. during manual reset, status becomes hh (reset) and the internal reset begins after waiting for the executing bus cycle to end. 2. reset: hh (status1 high, status0 high) 3. normal: ll (status1 low, status0 low) 4. bcyc: bus clock cycle figure 22.3 manual reset status output
rev. 4.00, 03/04, page 541 of 660 ? timing for canceling software standbys software standby to interrupt: ckio status normal * 2 normal * 2 wdt count oscillation stops standby * 1 interrupt request wdt overflow notes: 1. standby: lh (status1 low, status0 high) 2. normal: ll (status1 low, status0 low) figure 22.4 software standby to interrupt status output software standby to power-on reset: ckio status normal * 4 normal * 4 oscillation stops standby * 3 0 to 10 bcyc * 5 0 to 30 bcyc * 5 reset reset * 2 * 1 * 6 notes: 1. when software software standby mode is cleared with a power-on reset, the wdt does not count. keep low during the pll's oscillation settling time. 2. reset: hh (status1 high, status0 high) 3. standby: lh (status1 low, status0 high) 4. normal: ll (status1 low, status0 low) 5. bcyc: bus clock cycle 6. undefined figure 22.5 software standby to power-on reset status output
rev. 4.00, 03/04, page 542 of 660 software standby to manual reset: ckio status normal * 4 normal * 4 oscillation stops standby * 3 reset * 2 0 to 20 bcyc * 5 reset * 1 notes: 1. when software standby mode is cleared with a manual reset, the wdt does not count. keep low during the pll?s oscillation settling time. 2. reset: hh (status1 high, status0 high) 3. standby: lh (status1 low, status0 high) 4. normal: ll (status1 low, status0 low) 5. bcyc: bus clock cycle figure 22.6 software standby to manual reset status output ? timing for canceling sleep mode sleep to interrupt: ckio status normal * 2 normal * 2 sleep * 1 interrupt request notes: 1. sleep: hl (status1 high, status0 low) 2. normal: ll (status1 low, status0 low) figure 22.7 sleep to interrupt status output
rev. 4.00, 03/04, page 543 of 660 sleep to power-on reset: ckio status normal * 4 normal * 4 sleep * 3 0 to 10 bcyc * 5 0 to 30 bcyc * 5 reset reset * 3 * 6 * 1 notes: 1. when the pll1 ? s multiplication ratio is changed by a power-on reset, keep low during the pll ? s oscillation settling time. 2. reset: hh (status1 high, status0 high) 3. sleep: hl (status1 high, status0 low) 4. normal: ll (status1 low, status0 low) 5. bcyc: bus clock cycle 6. undefined figure 22.8 sleep to power-on reset status output sleep to manual reset: ckio 0 to 80 bcyc * 5 0 to 30 bcyc * 5 reset status normal * 4 normal * 4 sleep * 3 reset * 2 * 1 notes: 1. keep low until status becomes reset. 2. reset: hh (status1 high, status0 high) 3. sleep: hl (status1 high, status0 low) 4. normal: ll (status1 low, status0 low) 5. bcyc: bus clock cycle figure 22.9 sleep to manual reset status output
rev. 4.00, 03/04, page 544 of 660 22.3.5 hardware standby function ? transition to hardware standby mode driving the ca pin low causes a transition to hardware standby mode. in hardware standby mode, all modules except those operating on an rtc clock are halted, as in the software standby mode entered on execution of a sleep instruction ((software) standby mode). hardware standby mode differs from software standby mode as follows. 1. interrupts and manual resets are not accepted. 2. the tmu does not operate. operation when a low-level signal is input at the ca pin depends on the cpg state, as follows. 1. in software standby mode the clock remains stopped and the chip enters the hardware standby state. acceptance of interrupts and manual resets is disabled, tclk output is fixed low, and the tmu halts. 2. during wdt operation when software standby mode is canceled by an interrupt the chip enters hardware standby mode after standby mode is canceled and the cpu resumes operation. 3. in sleep mode the chip enters hardware standby mode after sleep mode is canceled and the cpu resumes operation. hold the ca pin low in hardware standby mode. in hardware standby mode, the lsi can supply power only to the rtc power-supply pin. ? canceling hardware standby mode hardware standby mode can only be canceled by a power-on reset. when the ca pin is driven high while the resetp pin is low, clock oscillation is started. hold the resetp pin low until clock oscillation stabilizes. when the resetp pin is driven high, the cpu begins power-on reset processing. if an interrupt or manual reset is input, correct operation cannot be guaranteed.
rev. 4.00, 03/04, page 545 of 660 ? hardware standby mode timing figures 22.10 and 22.11 show examples of pin timing in hardware standby mode. the ca pin is sampled using extal2 (32.768 khz), and a hardware standby request is only recognized when the pin is low for two consecutive clock cycles. the ca pin must be held low while the chip is in hardware standby mode. clock oscillation starts when the ca pin is driven high after the resetp pinisdrivenlow. normal * 3 status ca ckio standby * 2 undefined 2 rcyc or more * 5 0 to 10bcyc * 4 0 to 30bcyc * 4 notes: 1. reset: hh (status1 high, status0 high) 2. standby: lh (status1 low, status0 high) 3. normal: ll (status1 low, status0 low) 4. bcyc: bus clock cycle 5. rcyc: extal2 (32.768 khz) cycle reset * 1 normal * 3 figure 22.10 hardware standby mode (when ca goes low in normal operation)
rev. 4.00, 03/04, page 546 of 660 normal * 3 status ca ckio standby * 2 reset * 1 resetp undefined 2 rcyc or more * 5 0 to 10 bcyc * 4 standby * 2 wdt operation notes: 1. reset: hh (status1 high, status0 high) 2. standby: lh (status1 low, status0 high) 3. normal: ll (status1 low, status0 low) 4. bcyc: bus clock cycle 5. rcyc: extal2 (32.768 khz) cycle figure 22.11 hardware standby mode timing (when ca goes low during wdt operation on standby mode cancellation)
rev. 4.00, 03/04, page 547 of 660 section 23 list of registers 23.1 register address map control register module * 1 bus * 2 address size (bits) access size (bits) * 3 pteh ccn l h'fffffff0 32 32 ptel l h'fffffff4 32 32 ttb l h'fffffff8 32 32 tea l h'fffffffc 32 32 mmucr l h'ffffffe0 32 32 basra l h'ffffffe4 8 8 basrb l h'ffffffe8 8 8 ccr l h'ffffffec 32 32 ccr2 i h'a40000b0 32 32 tra l h'ffffffd0 32 32 expevt l h'ffffffd4 32 32 intevt l h'ffffffd8 32 32 bara ubc l h'ffffffb0 32 32 bamra l h'ffffffb4 32 32 bbra l h'ffffffb8 16 16 barb l h'ffffffa0 32 32 bamrb l h'ffffffa4 32 32 bbrb l h'ffffffa8 16 16 bdrb l h'ffffff90 32 32 bdmrb l h'ffffff94 32 32 brcr l h'ffffff98 32 32 betr l h'ffffff9c 16 16 brsr l h'ffffffac 32 32 brdr l h'ffffffbc 32 32 frqcr cpg i h'ffffff80 16 16 stbcr i h'ffffff82 8 8 stbcr2 i h'ffffff88 8 8 wtcnt i h'ffffff84 8 8, 16 wtcsr i h'ffffff86 8 8, 16 bcr1 bsc i h'ffffff60 16 16 bcr2 i h'ffffff62 16 16
rev. 4.00, 03/04, page 548 of 660 control register module * 1 bus * 2 address size (bits) access size (bits) * 3 wcr1 bsc i h'ffffff64 16 16 wcr2 i h'ffffff66 16 16 mcr i h'ffffff68 16 16 pcr i h'ffffff6c 16 16 rtcsr i h'ffffff6e 16 16 rtcnt i h'ffffff70 16 16 rtcor i h'ffffff72 16 16 rfcr i h'ffffff74 16 16 sdmr i h'ffffd000 to h'ffffefff ?8 r64cnt rtc p h'fffffec0 8 8 rseccnt p h'fffffec2 8 8 rmincnt p h'fffffec4 8 8 rhrcnt p h'fffffec6 8 8 rwkcnt p h'fffffec8 8 8 rdaycnt p h'fffffeca 8 8 rmoncnt p h'fffffecc 8 8 ryrcnt p h'fffffece 8 8 rsecar p h'fffffed0 8 8 rminar p h'fffffed2 8 8 rhrar p h'fffffed4 8 8 rwkar p h'fffffed6 8 8 rdayar p h'fffffed8 8 8 rmonar p h'fffffeda 8 8 rcr1 p h'fffffedc 8 8 rcr2 p h'fffffede 8 8 icr0 intc i h'fffffee0 16 16 ipra i h'fffffee2 16 16 iprb i h'fffffee4 16 16
rev. 4.00, 03/04, page 549 of 660 control register module * 1 bus * 2 address size (bits) access size (bits) * 3 tocr tmu p h'fffffe90 8 8 tstr p h'fffffe92 8 8 tcor_0 p h'fffffe94 32 32 tcnt_0 p h'fffffe98 32 32 tcr_0 p h'fffffe9c 16 16 tcor_1 p h'fffffea0 32 32 tcnt_1 p h'fffffea4 32 32 tcr_1 p h'fffffea8 16 16 tcor_2 p h'fffffeac 32 32 tcnt_2 p h'fffffeb0 32 32 tcr_2 p h'fffffeb4 16 16 tcpr_2 p h'fffffeb8 32 32 scsmr sci p h'fffffe80 8 8 scbrr p h'fffffe82 8 8 scscr p h'fffffe84 8 8 sctdr p h'fffffe86 8 8 scssr p h'fffffe88 8 8 scrdr p h'fffffe8a 8 8 scscmr p h'fffffe8c 8 8 intevt2 intc i h'04000000 32 32 irr0 i h'a4000004 16 8 irr1 i h'a4000006 16 8 irr2 i h'a4000008 16 8 icr1 i h'a4000010 16 16 iprc i h'a4000016 16 16 iprd i h'a4000018 16 16 ipre i h'a400001a 16 16 sar_0 dmac p h'a4000020 32 16,32 dar_0 p h'a4000024 32 16,32 dmatcr_0 p h'a4000028 32 16,32 chcr_0 p h'a400002c 32 8,16,32
rev. 4.00, 03/04, page 550 of 660 control register module * 1 bus * 2 address size (bits) access size (bits) * 3 sar_1 dmac p h'a4000030 32 16,32 dar_1 p h'a4000034 32 16,32 dmatcr_1 p h'a4000038 32 16,32 chcr_1 p h'a400003c 32 8,16,32 sar_2 p h'a4000040 32 16,32 dar_2 p h'a4000044 32 16,32 dmatcr_2 p h'a4000048 32 16,32 chcr_2 p h'a400004c 32 8,16,32 sar_3 p h'a4000050 32 16,32 dar_3 p h'a4000054 32 16,32 dmatcr_3 p h'a4000058 32 16,32 chcr_3 p h'a400005c 32 8,16,32 dmaor p h'a4000060 16 8,16 cmstr cmt p h'a4000070 16 8,16,32 cmcsr p h'a4000072 16 8,16,32 cmcnt p h'a4000074 16 8,16,32 cmcor p h'a4000076 16 8,16,32 addrah a/d p h'a4000080 8 8,16,32 * 4 * 5 addral p h'a4000082 8 8,16 * 4 addrbh p h'a4000084 8 8,16,32 * 4 * 5 addrbl p h'a4000086 8 8,16 * 4 addrch p h'a4000088 8 8,16,32 * 4 * 5 addrcl p h'a400008a 8 8,16 * 4 addrdh p h'a400008c 8 8,16,32 * 4 * 5 addrdl p h'a400008e 8 8,16 * 4 adcsr p h'a4000090 8 8,16,32 * 4 * 5 adcr p h'a4000092 8 8,16 dadr0 d/a p h'a40000a0 8 8,16,32 * 4 * 5 dadr1 p h'a40000a2 8 8,16 * 4 dacr p h'a40000a4 8 8,16,32
rev. 4.00, 03/04, page 551 of 660 control register module * 1 bus * 2 address size (bits) access size (bits) * 3 pacr port p h'a4000100 16 16 pbcr p h'a4000102 16 16 pccr p h'a4000104 16 16 pdcr p h'a4000106 16 16 pecr p h'a4000108 16 16 pfcr p h'a400010a 16 16 pgcr p h'a400010c 16 16 phcr p h'a400010e 16 16 pjcr p h'a4000110 16 16 scpcr p h'a4000116 16 16 padr p h'a4000120 8 8 pbdr p h'a4000122 8 8 pcdr p h'a4000124 8 8 pddr p h'a4000126 8 8 pedr p h'a4000128 8 8 pfdr p h'a400012a 8 8 pgdr p h'a400012c 8 8 phdr p h'a400012e 8 8 pjdr p h'a4000130 8 8 scpdr p h'a4000136 8 8 scsmr2 scif p h'a4000150 8 8 scbrr2 p h'a4000152 8 8 scscr2 p h'a4000154 8 8 scftdr2 p h'a4000156 8 8 scssr2 p h'a4000158 16 16 scfrdr2 p h'a400015a 8 8 scfcr2 p h'a400015c 8 8 scfdr2 p h'a400015e 16 16 sdir udi i h'a4000200 16 16
rev. 4.00, 03/04, page 552 of 660 notes: 1. modules: ccn: cache controller ubc: user break controller cpg: clock pulse generator bsc: bus state controller rtc: realtime clock intc: interrupt controller tmu: timer unit sci: serial communication interface 2. internal buses: l: cpu, ccn, cache, and tlb connected i: bsc, cache, dmac, intc, cpg, and h-udi connected p: bsc and peripheral modules (rtc, tmu, sci, scif, a/d, d/a, dmac, ports, cmt) connected 3. the access size shown is for control register access (read/write). an incorrect result will be obtained if a different size from that shown is used for access. 4. with 16-bit access, it is not possible to read data in two registers simultaneously. 5. with 32-bit access, it is not possible to read data in the register at [accessed address + 2] simultaneously.
rev. 4.00, 03/04, page 553 of 660 23.2 register bits the following are the bit-name of each registers. the 16-bit and 32-bit registers are shown by two and four 8-bit rows, respectively. register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module scsmr c/ a chr pe o/ e stop mp cks1 cks0 sci scbrr scscr tie rie te re mpie teie cke1 cke0 sctdr scssr tdre rdrf orer fer/ers per tend mpb mpbt scrdr scscmr ? ? ? ? sdir sinv ? smif scfrdr2 scif scftdr2 scsmr2 ? chr pe o/ e stop ? cks1 cks0 scscr2 tie rie te re ? ? cke1 cke0 scssr2 er tend tdfe brk fer per rdf dr scbrr2 scfcr2 rtrg1 rtrg0 ttrg1 ttrg0 mce tfrst rfrst loop scfdr2 tocr???????tcoetmu tstr ? ? ? ? ? str2 str1 str0 tcor_0 tcnt_0 ???????unf tcr_0 ? ? unie ckeg1 ckeg0 tpsc2 tpsc1 tpsc0
rev. 4.00, 03/04, page 554 of 660 register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module tcor_1 tmu tcnt_1 ???? ???unf tcr_1 ? ? unie ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tcor_2 tcnt_2 ???? ??icpfunf tcr_2 icpe1 icpe0 unie ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 tcpr_2 r64cnt ? 1hz 2hz 4hz 8hz 16hz 32hz 64hz rtc rseccnt ? 10 sec 1 sec rmincnt ? 10 min 1 min rhrcnt ? ? 10 hours 1 hour rwkcnt ? ? ? ? ? day of week rdaycnt ? ? 10 days 1 day rmoncnt ? ? ? 10 months 1 month
rev. 4.00, 03/04, page 555 of 660 register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module ryrcnt 10 years 1 year rtc rsecar enb 10 sec 1 sec rminar enb 10 min 1 min rhrar enb ? 10 hours 1 hour rwkar enb ? ? ? ? day of week rdayar enb ? 10 days 1 day rmonar enb ? ? 10 months 1 month rcr1 cf ? ? cie aie ? ? af rcr2 pef pes2 pes1 pes0 rtcen adj reset start nml??? ???nmie icr0 ???? ???? intc tmu0 tmu1 ipra tmu2 rtc wdt ref iprb sci ? ? ? ? pula puld hizmem hizcnt endian a0bst1 a0bst0 a5bst1 bcr1 a5bst0 a6bst1 a6bst0 dramtp2 dramtp1 dramtp0 a5pcm a6pcm bsc ? ? a6sz1 a6sz0 a5sz1 a5sz0 a4sz1 a4sz0 bcr2 a3sz1 a3sz0 a2sz1 a2sz0 ? ? ? ? waitsel ? a6iw1 a6iw0 a5iw1 a5iw0 a4iw1 a4iw0 wcr1 a3iw1 a3iw0 a2iw1 a2iw0 ? ? a0iw1 a0iw0 a6w2 a6w1 a6w0 a5w2 a5w1 a5w0 a4w2 a4w1 wcr2 a4w0 a3w1 a3w0 a2w1 a2w0 a0w2 a0w1 a0w0 tpc1 tpc0 rcd1 rcd0 trwl1 trwl0 tras1 tras0 mcr rasd amx3 amx2 amx1 amx0 rfsh rmode ? a6w3 a5w3 ? ? a5ted2 a6ted2 a5the2 a6the2 pcr a5ted1 a5ted0 a6ted1 a6ted0 a5the1 a5the0 a6the1 a6the0 ???? ???? rtcsr cmf cmie cks2 cks1 cks0 ovf ovie lmts ???? ???? rtcnt
rev. 4.00, 03/04, page 556 of 660 register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module ???????? rtcor bsc ???????? rfcr sdmr stc2 ifc2 pfc2 ? ? ? ? ? frqcr ? ? stc1 stc0 ifc1 ifc0 pfc1 pfc0 cpg stbcr stby ? ? stbytl ? mstp2 mstp1 mstp0 stbcr2 ? mdchg mstp8 mstp7 mstp6 mstp5 mstp4 ? wtcnt wtcsr tme wt/ it rsts wovf iovf cks2 cks1 cks0 bdb31 bdb30 bdb29 bdb28 bdb27 bdb26 bdb25 bdb24 bdb23 bdb22 bdb21 bdb20 bdb19 bdb18 bdb17 bdb16 bdb15 bdb14 bdb13 bdb12 bdb11 bdb10 bdb9 bdb8 bdrb bdb7 bdb6 bdb5 bdb4 bdb3 bdb2 bdb1 bdb0 ubc bdmb31 bdmb30 bdmb29 bdmb28 bdmb27 bdmb26 bdmb25 bdmb24 bdmb23 bdmb22 bdmb21 bdmb20 bdmb19 bdmb18 bdmb17 bdmb16 bdmb15 bdmb14 bdmb13 bdmb12 bdmb11 bdmb10 bdmb9 bdmb8 bdmrb bdmb7 bdmb6 bdmb5 bdmb4 bdmb3 bdmb2 bdmb1 bdmb0 ??? ????? ? ? basma basmb ? ? ? ? scmfca scmfcb scmfda scmfdb pcte pcba ? ? brcr dbeb pcbb ? ? seq ? ? etbe bab31 bab30 bab29 bab28 bab27 bab26 bab25 bab24 bab23 bab22 bab21 bab20 bab19 bab18 bab17 bab16 bab15 bab14 bab13 bab12 bab11 bab10 bab9 bab8 barb bab7 bab6 bab5 bab4 bab3 bab2 bab1 bab0 bamrb bamb31 bamb30 bamb29 bamb28 bamb27 bamb26 bamb25 bamb24 bamb23 bamb22 bamb21 bamb20 bamb19 bamb18 bamb17 bamb16 bamb15 bamb14 bamb13 bamb12 bamb11 bamb10 bamb9 bamb8 bamb7 bamb6 bamb5 bamb4 bamb3 bamb2 bamb1 bamb0
rev. 4.00, 03/04, page 557 of 660 register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module ??? ????? bbrb cdb1 cdb0 idb1 idb0 rwb1 rwb0 szb1 szb0 baa31 baa30 baa29 baa28 baa27 baa26 baa25 baa24 baa23 baa22 baa21 baa20 baa19 baa18 baa17 baa16 baa15 baa14 baa13 baa12 baa11 baa10 baa9 baa8 bara baa7 baa6 baa5 baa4 baa3 baa2 baa1 baa0 ubc bama31 bama30 bama29 bama28 bama27 bama26 bama25 bama24 bama23 bama22 bama21 bama20 bama19 bama18 bama17 bama16 bama15 bama14 bama13 bama12 bama11 bama10 bama9 bama8 bamra bama7 bama6 bama5 bama4 bama3 bama2 bama1 bama0 ???????? bbra cda1 cda0 ida1 ida0 rwa1 rwa0 sza1 sza0 ???? betr svf pid2 pid1 pid0 bsa27 bsa26 bsa25 bsa24 bsa23 bsa22 bsa21 bsa20 bsa19 bsa18 bsa17 bsa16 bsa15 bsa14 bsa13 bsa12 bsa11 bsa10 bsa9 bsa8 brsr bsa7 bsa6 bsa5 bsa4 bsa3 bsa2 bsa1 bsa0 dvf ? ? ? bda27 bda26 bda25 bda24 bda23 bda22 bda21 bda20 bda19 bda18 bda17 bda16 bda15 bda14 bda13 bda12 bda11 bda10 bda9 bda8 brdr bda7 bda6 bda5 bda4 bda3 bda2 bda1 bda0 basra basa7 basa6 basa5 basa4 basa3 basa2 basa1 basa0 basrb basb7 basb6 basb5 basb4 basb3 basb2 basb1 basb0 ???????? ???????? ??????imm tra ?? ccn ???????? ???????? ???? expevt
rev. 4.00, 03/04, page 558 of 660 register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module ???????? ???????? ???? intevt ccn ???????? ???????? ???????sv mmucr ? ? rc rc ? tf ix at ???????? ???????? ???????? ccr ? ? ? ? cf cb wt ce ???????? ???????? ??????w3loadw3lock ccr2 ??????w2loadw2lock vpn ?? pteh asid ppn ?v ptel ? prprsz c d sh? ttb tea
rev. 4.00, 03/04, page 559 of 660 register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module ???????? ???????? ???? intevt2 intc irr0 ? ? irq5r irq4r irq3r irq2r irq1r irq0r irr1 ? ? ? ? dei3r dei2r dei1r dei0r irr2 ? ? ? adir txi2r bri2r rxi2r eri2r mai irqlvl blmsk ? irq51s irq50s irq41s irq40s icr1 irq31s irq30s irq21s irq20s irq11s irq10s irq01s irq00s irq3 irq2 iprc irq1 irq0 ???????? iprd irq5 irq4 dmac ???? ipre scif a/d sar_0 dmac dar_0 ???????? dmatcr_0 ???????? ???dirorlamal dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 chcr_0 ?dstmts1ts0ietede
rev. 4.00, 03/04, page 560 of 660 register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module sar_1 dmac dar_1 ???????? dmatcr_1 ???????? ???dirorlamal dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 chcr_1 ?dstmts1ts0ietede sar_2 dar_2 ???????? dmatcr_2 ???????? ???dirorlamal dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 chcr_2 ?dstmts1ts0ietede
rev. 4.00, 03/04, page 561 of 660 register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module sar_3 dmac dar_3 ???????? dmatcr_3 ???????? ???dirorlamal dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 chcr_3 ?dstmts1ts0ietede ??????pr1pr0 dmaor ?????aenmifdme ???????? cmstr ???????str0 cmt ???????? cmcsr cmf?????cks1cks0 cmcnt cmcor
rev. 4.00, 03/04, page 562 of 660 register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module addrah ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 a/d addral ad1 ad0 ? ? ? ? ? ? addrbh ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addrbl ad1 ad0 ? ? ? ? ? ? addrch ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addrcl ad1 ad0 ? ? ? ? ? ? addrdh ad9 ad8 ad7 ad6 ad5 ad4 ad3 ad2 addrdl ad1 ad0 ? ? ? ? ? ? adcsr adf adie adst multi cks ch2 ch1 ch0 adcr trge trge0 scn ? ? ? ? ? dadr0 d/a dadr1 dacr daoe1 daoe0 dae ? ? ? ? ? pa7md1 pa7md0 pa6md1 pa6md0 pa5md1 pa5md0 pa4md1 pa4md0 pacr pa3md1 pa3md0 pa2md1 pa2md0 pa1md1 pa1md0 pa0md1 pa0md0 port pb7md1 pb7md0 pb6md1 pb6md0 pb5md1 pb5md0 pb4md1 pb4md0 pbcr pb3md1 pb3md0 pb2md1 pb2md0 pb1md1 pb1md0 pb0md1 pb0md0 pc7md1 pc7md0 pc6md1 pc6md0 pc5md1 pc5md0 pc4md1 pc4md0 pcdr pc3md1 pc3md0 pc2md1 pc2md0 pc1md1 pc1md0 pc0md1 pc0md0 pd7md1 pd7md0 pd6md1 pd6md0 pd5md1 pd5md0 pd4md1 pd4md0 pdcr pd3md1 pd3md0 pd2md1 pd2d0 pd1md1 pd1md0 pd0md1 pd0md0 pe7md1 pe7md0 pe6md1 pe6md0 pe5md1 pe5md0 pe4md1 pe4md0 pecr pe3md1 pe3md0 pe2md1 pe2md0 pe1md1 pe1md0 pe0md1 pe0md0 ? ? pf6md1 pf6md0 pf5md1 pf5md0 pf4md1 pf4md0 pfcr pf3md1 pf3md0 pf2md1 pf2md0 pf1md1 pf1md0 pf0md1 pf0md0 ? ? ? ? pg5md1 pg5md0 pg4md1 pg4md0 pgcr pg3md1 pg3md0 pg2md1 pg2md0 pg1md1 pg1md0 pg0md1 pg0md0 ? ? ph6md1 ph6md0 ph5md1 ph5md0 ph4md1 ph4md0 phcr ph3md1 ph3md0 ph2md1 ph2md0 ph1md1 ph1md0 ph0md1 ph0md0 ???????? pjcr pj3md1 pj3md0 pj2md1 pj2md0 pj1md1 pj1md0 pj0md1 pj0md0 ???? scp5md1 scp5md0 scp4md1 scp4md0 scpcr scp3md1 scp3md0 scp2md1 scp2md0 scp1md1 scp1md0 scp0md1 scp0md0
rev. 4.00, 03/04, page 563 of 660 register bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 module padr pa7dt pa6dt pa5dt pa4dt pa3dt pa2dt pa1dt pa0dt port pbdr pb7dt pb6dt pb5dt pb4dt pb3dt pb2dt pb1dt pb0dt pcdr pc7dt pc6dt pc5dt pc4dt pc3dt pc2dt pc1dt pc0dt pddr pd7dt pd6dt pd5dt pd4dt pd3dt pd2dt pd1dt pd0dt pedr pe7dt pe6dt pe5dt pe4dt pe3dt pe2dt pe1dt pe0dt pfdr ? pf6dt pf5dt pf4dt pf3dt pf2dt pf1dt pf0dt pgdr ? ? pg5dt pg4dt pg3dt pg2dt pg1dt pg0dt phdr ? ph6dt ph5dt ph4dt ph3dt ph2dt ph1dt ph0dt pjdr ? ? ? ? pj3dt pj2dt pj1dt pj0dt scpdr ? ? scp5dt scp4dt scp3dt scp2dt scp1dt scp0dt ti3 ti2 ti1 ti0 ? ? ? ? sdir ???????? udi
rev. 4.00, 03/04, page 564 of 660 23.3 register states in processing mode register name power-on reset manual reset hardware standby software standby module standby sleep module pteh undefined undefined held held held held ccn ptel undefined undefined held held held held ttb undefined undefined held held held held tea undefined undefined held held held held mmucr initialized * 1 initialized * 1 held held held held basra undefined undefined held held held held basrb undefined undefined held held held held ccr initialized initialized held held held held ccr2 initialized initialized held held held held tra undefined undefined held held held held expevt initialized initialized held held held held intevt undefined undefined held held held held bara initialized initialized held held held held ubc bamra initialized initialized held held held held bbra initialized initialized held held held held barb initialized initialized held held held held bamrb initialized initialized held held held held bbrb initialized initialized held held held held bdrb initialized initialized held held held held bdmrb initialized initialized held held held held brcr initialized initialized held held held held betr initialized initialized held held held held brsr initialized * 1 initialized * 1 held held held held brdr initialized * 1 initialized * 1 held held held held frqcr initialized * 2 held held held held held cpg stbcr initialized held held held held held stbcr2 initialized held held held held held wtcnt initialized * 2 held held held held held wtcsr initialized * 2 held held held held held
rev. 4.00, 03/04, page 565 of 660 register name power-on reset manual reset hardware standby software standby module standby sleep module bcr1 initialized held held held held held bsc bcr2 initialized held held held held held wcr1 initialized held held held held held wcr2 initialized held held held held held mcr initialized held held held held held pcr initialized held held held held held rtcsr initialized held held held held held rtcnt initialized held held held held held rtcor initialized held held held held held rfcr initialized held held held held held r64cnt held held held held held held rtc rseccnt held held held held held held rmincnt held held held held held held rhrcnt held held held held held held rwkcnt held held held held held held rdaycnt held held held held held held rmoncnt held held held held held held ryrcnt held held held held held held rsecar held * 3 held * 3 held held held held rminar held * 3 held * 3 held held held held rhrar held * 3 held * 3 held held held held rwkar held * 3 held * 3 held held held held rdayar held * 3 held * 3 held held held held rmonar held * 3 held * 3 held held held held rcr1 initialized initialized held held held held rcr2 initialized initialized held held held held icr0 initialized initialized held held held held intc ipra initialized initialized held held held held iprb initialized initialized held held held held tocr initialized initialized held held held held tmu tstr initialized initialized held held held held tcor_0 initialized initialized held held held held
rev. 4.00, 03/04, page 566 of 660 register name power-on reset manual reset hardware standby software standby module standby sleep module tcnt_0 initialized initialized held held held held tmu tcr_0 initialized initialized held held held held tcor_1 initialized initialized held held held held tcnt_1 initialized initialized held held held held tcr_1 initialized initialized held held held held tcor_2 initialized initialized held held held held tcnt_2 initialized initialized held held held held tcr_2 initialized initialized held held held held tcpr_2 undefined undefined held held held held scsmr initialized initialized initialized initialized initialized held sci scbrr initialized initialized initialized initialized initialized held scscr initialized initialized initialized initialized initialized held sctdr initialized initialized initialized initialized initialized held scssr initialized initialized initialized initialized initialized held scrdr initialized initialized initialized initialized initialized held scscmr initialized initialized initialized initialized initialized held intevt2 undefined undefined held held held held intc irr0 initialized initialized held held held held irr1 initialized initialized held held held held irr2 initialized initialized held held held held icr1 initialized initialized held held held held iprc initialized initialized held held held held iprd initialized initialized held held held held ipre initialized initialized held held held held sar_0 undefined undefined held held held held dmac dar_0 undefined undefined held held held held dmatcr_0 undefined undefined held held held held chcr_0 initialized initialized held held held held sar_1 undefined undefined held held held held dar_1 undefined undefined held held held held dmatcr_1 undefined undefined held held held held chcr_1 initialized initialized held held held held
rev. 4.00, 03/04, page 567 of 660 register name power-on reset manual reset hardware standby software standby module standby sleep module sar_2 undefined undefined held held held held dmac dar_2 undefined undefined held held held held dmatcr_2 undefined undefined held held held held chcr_2 initialized initialized held held held held sar_3 undefined undefined held held held held dar_3 undefined undefined held held held held dmatcr_3 undefined undefined held held held held chcr_3 initialized initialized held held held held dmaor initialized initialized held held held held cmstr initialized initialized held held held held cmt cmcsr initialized initialized held held held held cmcnt initialized initialized held held held held cmcor initialized initialized held held held held addrah initialized initialized initialized initialized initialized held adc addral initialized initialized initialized initialized initialized held addrbh initialized initialized initialized initialized initialized held addrbl initialized initialized initialized initialized initialized held addrch initialized initialized initialized initialized initialized held addrcl initialized initialized initialized initialized initialized held addrdh initialized initialized initialized initialized initialized held addrdl initialized initialized initialized initialized initialized held adcsr initialized initialized initialized initialized initialized held adcr initialized initialized initialized initialized initialized held dadr0 initialized initialized held held held held dac dadr1 initialized initialized held held held held dacr initialized initialized held held held held pacr initialized held held held held held port pbcr initialized held held held held held pccr initialized held held held held held pdcr initialized held held held held held pecr initialized held held held held held pfcr initialized held held held held held
rev. 4.00, 03/04, page 568 of 660 register name power-on reset manual reset hardware standby software standby module standby sleep module pgcr initialized held held held held held port phcr initialized held held held held held pjcr initialized held held held held held scpcr initialized held held held held held padr initialized held held held held held pbdr initialized held held held held held pcdr initialized held held held held held pddr initialized held held held held held pedr initialized held held held held held pfdr initialized held held held held held pgdr initialized held held held held held phdr initialized held held held held held pjdr initialized held held held held held scpdr initialized held held held held held scsmr2 initialized initialized initialized initialized initialized held scif scbrr2 initialized initialized initialized initialized initialized held scscr2 initialized initialized initialized initialized initialized held scftdr2 undefined undefined undefined undefined undefined held scssr2 initialized initialized initialized initialized initialized held scfrdr2 undefined undefined undefined undefined undefined held scfcr2 initialized initialized initialized initialized initialized held scfdr2 initialized initialized initialized initialized initialized held sdir * 4 held held held held held held udi notes: 1. some bits are not initialized. 2. these bits are not initialized at a power-on reset by the wdt. 3. some bits are initialized. 4. initialized on asserting state of trst or on test-logic-reset state of tap.
rev. 4.00, 03/04, page 569 of 660 section 24 electrical characteristics 24.1 absolute maximum ratings table 24.1 shows the absolute maximum ratings. table 24.1 absolute maximum ratings item symbol rating unit power supply voltage (i/o) vccq ?0.3 to 4.2 v power supply voltage (internal) vcc vcc ? pll1 vcc ? pll2 vcc ? rtc ?0.3to2.5 v input voltage (except port j) vin ?0.3 to vccq + 0.3 v input voltage (port j) vin ?0.3 to avcc + 0.3 v analog power-supply voltage avcc ?0.3 to 4.6 v analog input voltage v an ?0.3 to avcc + 0.3 v operating temperature topr ?20 to 75 c storage temperature tstr ?55 to 125 c cautions: ? operating the chip in excess of the absolute maximum rating may result in permanent damage. ? order of turning on or off 1.9 v power (vcc, vcc-pll1, vcc-pll2, vcc-rtc) and 3.3 v power (vccq, avcc): 1. the voltage of 1.9 v power should not be higher than that of 3.3 v power. the period when only 3.3 v power is turned on should be less than 1 ms. this period should be as short as possible. 2. until voltage is applied to all power supplies, a high level is input at the ca pin, and a low level is input at the resetp pin, and ckio clocks are equal to or below 4 clocks, internal circuits remain unsettled, and so pin states are also undefined. the system design must ensure that these undefined states do not cause erroneous system operation. when the ca pin is at a low level, the low level of the resetp pin is not accepted.
rev. 4.00, 03/04, page 570 of 660 waveforms at power-on are shown in the following figure. pin states undefined (max. 1ms) 3.3 v 1.9 v 3.3 v power 1.9 v power resetp all other pins * pin states undefined power-on reset state note: * except power/gnd, clock related, and analog pins power-on sequence
rev. 4.00, 03/04, page 571 of 660 24.2 dc characteristics table 24.2 lists dc characteristics. table 24.2 dc characteristics (ta = ?20 to 75c) item symbol min typ max unit measurement conditions 3.0 3.3 3.6 power supply voltage vccq vcc, vcc-pll1, vcc-pll2, vcc-rtc 1.75 1.90 2.05 v icc * 2 ? 250 400 vcc = 1.9 v, i = 133 mhz normal operation iccq * 3 ? 20 40 vccq = 3.3 v, b =33mhz icc * 2 ?1530 in sleep mode * 1 iccq * 3 ?1020 ma b =33mhz vccq = 3.3 v, vcc = 1.9 v icc * 2 ? 40 125 iccq * 3 ?1025 ta = 25c (rtc on) vccq = 3.3 v, vcc = 1.9 v icc * 2 ? 35 110 in standby mode iccq * 3 ?1025 ta=25c(rtcoff) * 5 vccq = 3.3 v, vcc = 1.9 v current dissipation rtc current icc-rtc * 4 ??15 a vcc-rtc = 1.9 v resetp , resetm , nmi, irq5 to irq0, md5 to md0, asemd0 , ca, trst , adtrg , extal, ckio vccq 0.9 ? vccq + 0.3 port j 2.0 ? avcc + 0.3 input high voltage other input pins v ih 2.0 ? vccq + 0.3 v
rev. 4.00, 03/04, page 572 of 660 item symbol min typ max unit measurement conditions resetp , resetm , nmi, irq5 to irq0, md5 to md0, asemd0 , ca, trst , adtrg , extal, ckio ?0.3 ? vccq 0.1 port j ?0.3 ? avcc 0.2 input low voltage other input pins v il ?0.3 ? vccq 0.2 v input leak current all input pins i iin i ? ? 1.0 a vin = 0.5 to vccq?0.5 v three- state leak current i/o, all output pins (off condition) i isti i ? ? 1.0 a vin = 0.5 to vccq?0.5 v 2.4 ? ? vccq = 3.0 v, ioh = ?200 a output high voltage all output pins v oh 2.0 ? ? vccq = 3.0 v, ioh = ?2 ma output low voltage all output pins v ol ? ? 0.55 v vccq = 3.6 v, iol = 1.6 ma pull-up resistance port pin ppull 30 60 120 k ? pin capacity all pins c ? ? 10 pf analog power- supply voltage avcc 3.0 3.3 3.6 v
rev. 4.00, 03/04, page 573 of 660 item symbol min typ max unit measurement conditions during a/d conversion aicc ? 0.8 2 ma during a/d and d/a conversion ?2.46 ma analog power- supply current idle ? 0.01 5.0 a ta = 25c notes: regardless of whether pll or rtc is used, connect vcc ? pll and vcc ? rtc to vcc, and vss ? pll and vss ? rtc to vss. avcc must be under condition of vccq ? 0.3 v avcc vccq + 0.3 v. if the a/d and d/a converters are not used, do not leave the avcc and avss pins open. connect avcc to vccq, and connect avss to vssq. current dissipation values shown are the values at which all output pins are without load under conditions of v ih min = vccq ? 0.5 v, v il max = 0.5 v. 1. no external bus cycles except refresh cycles. 2. total current of vcc, vcc ? pll1, and vcc ? pll2 3. current of vccq 4. current of vcc ? rtc 5. only in software standby mode table 24.3 permitted output current values (vccq = 3.3 0.3 v, vcc = 1.9 0.15 v, avcc = 3.3 0.3 v, ta = ?20 to 75c) item symbol min typ max unit output low-level permissible current (per pin) i ol ??2.0ma output low-level permissible current (total) i ol ? ? 120 ma output high-level permissible current (per pin) ?i oh ??2.0ma output high-level permissible current (total) (?i oh )??40ma caution: to ensure lsi reliability, do not exceed the value for output current given in table 24.3.
rev. 4.00, 03/04, page 574 of 660 24.3 ac characteristics in general, inputting for this lsi should be clock synchronous. keep the setup and hold times for each input signal unless otherwise specified. operating conditons are as follows: vccq = 3.3 0.3v vcc = 1.9 0.15v avcc = 3.3 0.3v ta = ? 20 to 75 c table 24.4 operating frequency range item symbol min typ max unit remarks cpu, cache, tlb 25 ? 133.34 external bus 25 ? 66.67 operating frequency peripheral module f 6.25 ? 33.34 mhz 24.3.1 clock timing table 24.5 clock timing item symbol min max unit figure extal clock input frequency (clock mode 0) f ex 25 66.67 mhz extal clock input cycle time (clock mode 0) t excyc 15 40 ns extal clock input frequency (clock mode 1) f ex 6.25 16.67 mhz extal clock input cycle time (clock mode 1) t excyc 60 160 ns extal clock input low pulse width t exl 1.5 ? ns extal clock input high pulse width t exh 1.5 ? ns extal clock input rise time t exr ?6ns extal clock input fall time t exf ?6ns 24.1
rev. 4.00, 03/04, page 575 of 660 item symbol min max unit figure ckio clock input frequency f cki 25 66.67 mhz ckio clock input cycle time t ckicyc 15 40 ns ckio clock input low pulse width t ckil 1.5 ? ns ckio clock input high pulse width t ckih 1.5 ? ns ckio clock input rise time t ckir ?6ns ckio clock input fall time t ckif ?6ns 24.2 ckio clock output frequency f op 25 66.67 mhz ckio clock output cycle time t cyc 15 40 ns ckio clock output low pulse width t ckol 3?ns ckio clock output high pulse width t ckoh 3?ns ckio clock output rise time t ckor ?5ns ckio clock output fall time t ckof ?5ns 24.3 power-on oscillation settling time t osc1 10 ? ms 24.4 resetp setuptime(atthepower-onor at the release from standby mode) t resps 20 ? ns resetm setup time (at the release from standby mode) t resms 0?ns resetp assert time (at the power-on or at the release from standby mode) t respw 20 ? tcyc resetm assert time (at the release from standby mode) t resmw 20 ? tcyc 24.4, 24.5 standby return oscillation settling time 1 t osc2 10 ? ms 24.5 standby return oscillation settling time 2 t osc3 10 ? ms 24.6 standby return oscillation settling time 3 t osc4 11 ? ms 24.7 pll synchronization settling time 1 (at the release from standby mode) t pll1 100 ? s 24.8, 24.9 pll synchronization settling time 2 (at the modification of multiplication rate) t pll2 100 ? s 24.10 irq/irl interrupt determination time (rtc is used in the standby mode) t irlstb 100 ? s 24.10
rev. 4.00, 03/04, page 576 of 660 t exh t exf t exr t exl t excyc v ih v ih v ih 1/2 v cc q 1/2 v cc q v il v il extal * (input) note: * the clock input from the extal pin. figure 24.1 extal clock input timing t ckih t ckif t ckir t ckil t ckicyc v ih 1/2 v cc q 1/2 v cc q v ih v il v ih v il ckio (input) figure 24.2 ckio clock input timing t cyc t ckol t ckoh v ih 1/2v cc q ckio (output) 1/2v cc q t ckor t ckof v oh v ol v ol v oh figure 24.3 ckio clock output timing
rev. 4.00, 03/04, page 577 of 660 v cc min t respw t resps t osc1 v cc note: oscillation settling time in clock mode 2. oscillation settling time becomes t osc1 = t pll1 (min. 100 s) except in clock mode 2. ckio, internal clock stable oscillation figure 24.4 power-on oscillation settling time ckio, internal clock stable oscillation standby t osc2 t respw/mw t resps/ms resetp , resetm note: oscillation settling time in the clock-mode-2 and oscillation-halt-mode figure 24.5 oscillation settling time at standby return (return by reset) ckio, internal clock stable oscillation standby t osc3 nmi note: oscillation settling time in the clock-mode-2 and oscillation-halt-mode figure 24.6 oscillation settling time at standby return (return by nmi)
rev. 4.00, 03/04, page 578 of 660 ckio, internal clock stable oscillation standby t osc4 irq4 to irq0 note: oscillation settling time in the clock-mode-2 and oscillation-halt-mode figure 24.7 oscillation settling time at standby return (return by irq or irl) extal input or ckio input stable input clock reset or nmi interrupt request stable input clock normal normal standby pll output, ckio output internal clock status 0 status 1 pll synchronization note: oscillation settling time in the clock-mode-0, 1, 7 and oscillation-halt-mode t pll1 pll synchronization figure 24.8 pll synchronization settling time by reset or nmi at the returning from standby mode (return by reset or nmi)
rev. 4.00, 03/04, page 579 of 660 extal input or ckio input stable input clock irq4 to irq0/ to interrupt request stable input clock normal normal pll output, ckio output internal clock status 0 status 1 note: oscillation settling time in the clock-mode-0, 1, 7 and oscillation-halt-mode t pll1 pll synchronization standby pll synchronization t irlstb figure 24.9 pll synchronization settling time at the returning from standby mode (return by irq/irl interrupt) extal input * 1 pll output, ckio output * 2 internal clock multiplication rate modified t pll2 notes: 1. ckio input in clock mode 7 2. pll output in clock mode 7 figure 24.10 pll synchronization settling time when frequency multiplication rate modified
rev. 4.00, 03/04, page 580 of 660 24.3.2 control signal timing table 24.6 control signal timing item symbol min max unit figure resetp pulse width t respw 20 * 3 ?tcyc resetp setup time * 1 t resps 20 ? ns resetp hold time t resph 2?ns resetm pulse width t resmw 12 * 4 ?tcyc resetm setup time t resms 6?ns resetm hold time t resmh 34 ? ns 24.11, 24.12 breq setup time t breqs 6?ns breq hold time t breqh 4?ns 24.14 nmi setup time * 1 t nmis 10 ? ns nmi hold time t nmih 4?ns irq5 to irq0 setup time * 1 t irqs 10 ? ns irq5 to irq0 hold time t irqh 4?ns irqout delay time t irqod ?10ns 24.12, 24.13 back delay time t backd ?10ns status1, status0 delay time t std ?10ns bus tri-state delay time 1 t boff1 015ns bus tri-state delay time 2 t boff2 015ns bus buffer-on time 1 t bon1 015ns bus buffer-on time 2 t bon2 015ns 24.14, 24.15 notes: 1. resetp , nmi, and irq5 to irq0 are asynchronous. changes are detected at the clock fall when the setup shown is used. when the setup cannot be used, detection can be delayed until the next clock falls. 2. the upper limit of the external bus clock is 66 mhz. 3. in the standby mode, when xtal oscillation continues, t respn =t osc1 (100s), when xtal oscillation stops, t respw =t osc2 (10 ms). in the sleep mode, t respw =t pll1 (100 s). when the clock multiplication ratio is changed, t respw =t pll1 (100 s). 4. in the standby mode, t resmw =t osc2 (10 ms). in the sleep mode, resetm must be kept low until status (0-1) changes to reset (hh). when the clock multiplication ratio is changed, resetm must be kept low until status (0-1) changes to reset (hh).
rev. 4.00, 03/04, page 581 of 660 ckio t resps/ms t resps/ms resetp , resetm t respw/mw figure 24.11 reset input timing ckio resetp , resetm t resph/mh t resps/ms v ih v il nmi t nmih t nmis v ih v il irq5 to irq0 t irqh t irqs v ih v il figure 24.12 interrupt signal input timing ckio t irqod t irqod figure 24.13 irqout irqout irqout irqout timing
rev. 4.00, 03/04, page 582 of 660 ckio breq back rd , rd/ wr , cas , cas , csn , wen , bs a25 to a0, d31 to d0 t backd t boff2 t boff1 t bon1 t backd t bon2 t breqh t breqh t breqs t breqs figure 24.14 bus release timing ckio t std t boff2 t boff1 t std t bon2 t bon1 normal mode standby mode normal mode status 0, status 1 rd , rd/ wr , ras , cas , csn , wen , bs a25 to a0, d31 to d0 figure 24.15 pin drive timing at standby
rev. 4.00, 03/04, page 583 of 660 24.3.3 ac bus timing table 24.7 bus timing (clock modes 0/1/2/7) item symbol min max unit figure address delay time t ad 1.5 12 ns 24.16 to 24.36, 24.39 to 24.46 address setup time t as 0 ? ns 24.16 to 24.18 address hold time t ah 4 ? ns 24.16 to 24.21 bs delay time t bsd ? 10 ns 24.16 to 24.36, 24.40 to 24.46 cs delay time 1 t csd1 ? 10 ns 24.16 to 24.21, 24.40 to 24.46 cs delay time 2 t csd2 ? 10 ns 24.16 to 24.21 cs delay time 3 t csd3 1.5 10 ns 24.24 to 24.39 read/write delay time t rwd 1.5 10 ns 24.16 to 24.46 read/write hold time t rwh 0 ? ns 24.16 to 24.21 read strobe delay time t rsd ? 10 ns 24.16 to 24.21 24.40 to 24.43 read data setup time 1 t rds1 6 ? ns 24.16 to 24.21, 24.40 to 24.46 read data setup time 2 t rds2 5 ? ns 24.22 to 24.25, 24.30 to 24.33 read data hold time 1 t rdh1 0 ? ns 24.16 to 24.21, 24.40 to 24.46 read data hold time 2 t rdh2 2 ? ns 24.22 to 24.25, 24.30 to 24.33 write enable delay time t wed ? 10 ns 24.16 to 22.18, 24.40 to 24.41 write data delay time 1 t wdd1 ? 12 ns 24.16 to 24.18, 24.40 to 24.41, 24.44 to 24.46 write data delay time 2 t wdd2 1.5 12 ns 24.20 to 24.29 writedataholdtime1 t wdh1 1.5 ? ns 24.16 to 24.18, 24.40 to 24.41, 24.44 to 24.46 writedataholdtime2 t wdh2 1.5 ? ns 24.26 to 24.29 writedataholdtime3 t wdh3 2 ? ns 24.16 to 24.18 writedataholdtime4 t wdh4 2 ? ns 24.40 to 24.41, 24.44 to 24.46 wait setup time t wts 5 ? ns 24.17 to 24.21, 24.41, 24.43, 24.45, 24.46 wait hold time t wth 0 ? ns 24.17 to 24.21, 24.41, 24.43, 24.45, 24.46 ras delay time t rasd 1.5 10 ns 24.22 to 24.39 cas delay time t casd 1.5 10 ns 24.22 to 24.39 dqm delay time t dqmd 1.5 10 ns 24.22 to 24.36
rev. 4.00, 03/04, page 584 of 660 item symbol min max unit figure cke delay time t cked 1.5 10 ns 24.38 iciord delay time t icrsd ? 10 ns 24.44 to 24.46 iciowr delay time t icwsd ? 10 ns 24.44 to 24.46 iois16 setup time t io16s 6 ? ns 24.45, 24.46 iois16 hold time t io16h 4 ? ns 24.45, 24.46 dack delay time 1 t dakd1 ? 12 ns 24.16 to 24.36, 24.39 to 24.46 dack delay time 2 t dakd2 ? 10 ns 24.16 to 24.18, 24.20 to 24.21
rev. 4.00, 03/04, page 585 of 660 24.3.4 basic timing t 1 ckio a25 to a0 csn rd/ wr rd d31 to d0 (read) wen d31 to d0 (write) bs t 2 t ad t ah t ad t csd1 t rwd t rsd t csd2 t wed t wdd1 t rds1 t bsd t bsd t dakd1 t dakd2 t rdh1 t rdh1 t wed t rsd t ah t rwh t rwd t wdh1 t rwh t rwh t ah t wdh3 dackn (read) (write) t as note: trdh1: stipulated from the faster negate timing of csn or rd tah: stipulated from the slower negate timing of csn , rd , or wen figure 24.16 basic bus cycle (no wait)
rev. 4.00, 03/04, page 586 of 660 t 1 t w t 2 ckio a25 to a0 rd/ d31 to d0 (read) d31 to d0 (write) t ad t ad t rwd t rwh t ah t ah t rsd t csd1 t wed t wdd1 t bsd t wts t wth t bsd t rds1 t csd2 t wed t rsd t rdh1 t rdh1 t rwd t ah t rwh t wdh3 t wdh1 t rwh t dakd1 t dakd2 dackn (read) (write) t as figure 24.17 basic bus cycle (one wait)
rev. 4.00, 03/04, page 587 of 660 t 1 t w t w t 2 ckio a25 to a0 csn rd/ wr rd d31 to d0 (read) wen d31 to d0 (write) bs wait t ad t ad t rwd t rsd t wed t wts t wth t bsd t bsd t rds1 t wts t wth t csd1 t csd2 t rsd t wed t rdh1 t ah t rwh t rdh1 t ah t rwh t rwd t rwh t ah t wdh3 t wdh1 t dakd1 t dakd2 dackn t wdd1 (read) (write) t as note: trdh1: stipulated from the faster negate timing of csn or rd tah: stipulated from the slower negate timing of csn , rd , or wen figure 24.18 basic bus cycle (external wait)
rev. 4.00, 03/04, page 588 of 660 24.3.5 burst rom timing ckio a25 to a4 a3 to a0 csn rd/ wr rd d31 to d0 bs dackn wait t ad t ad t ad t ad t csd1 t rwd t bsd t bsd t ah t bsd t dakd1 t dakd2 t csd2 t rsd t rds1 t wts t wth t rds t rsd t 1 t b2 t b1 t b2 t b1 t b2 t b1 t 2 t rsd t rdh1 t rsd t ah t rdh1 t rwh t ah t rwh t rwd t rdh1 t bsd note: in the write cycle, the basic bus cycle, the basic bus cycle is performed. trdh1: stipulated from the faster negate timing of csn or rd tah: stipulated from the slower negate timing of csn , rd , or wen figure 24.19 burst rom bus cycle (no wait)
rev. 4.00, 03/04, page 589 of 660 ckio a25 to a4 a3 to a0 csn rd/ wr rd d31 to d0 bs wait dackn t ad t ad t ad t csd1 t rwh t rwd t rsd t rsd t rdh1 t rdh1 t rds1 t dakd1 t dakd2 t bsd t bsd t wts t wth t wts t wth t 1 t w t w t b2 t b1 t b2 t w t 2 t 2 t csd2 t rds1 t rsd t rsd t ah t ah t rdh1 t ah t rsd t rwd t rwh t rdh1 note: in the write cycle, the basic bus cycle is performed. t bsd t bsd figure 24.20 burst rom bus cycle (two waits)
rev. 4.00, 03/04, page 590 of 660 ckio a25 to a4 a3 to a0 csn rd/ wr rd d31 to d0 bs dackn wait t 1 t w t w t b2 t b1 t 2 t bw t ad t ad t csd1 t csd2 t rwd t rwh t rdh1 t ah t ah t rwd t rsd t rsd1 t ah t ad t bsd t bsd t wts t wth t wts t wth t wts t wth t wts t wth t bsd t bsd t rds1 t rdh1 t rsd t dakd1 t dakd2 t rdh1 t rwh t rsd1 t rds note: in the write cycle, the basec bus cycle is performed. trdh1: stipulated from the faster negate timing of csn or rd tah: stipulated from the slower negate timing of csn , rd , or wen figure 24.21 burst rom bus cycle (external wait)
rev. 4.00, 03/04, page 591 of 660 24.3.6 synchronous dram timing ckio a12 or a11 rd/ dqmxx cke a25 to a16 a15 to a0 tr t ad tc1 tc2 (tpc) d31 to d0 t ad t ad t ad t ad t csd3 t rwd t csd3 t rwd t rasd t dqmd t dqmd t rdh2 t bsd t bsd (high) t rds2 t rasd t casd t casd t ad t ad t ad dackn t dakd1 t dakd1 read a command column address row address row address row address figure 24.22 synchronous dram read bus cycle (rcd = = = = 0, cas latency = = = = 1, tpc = = = = 0)
rev. 4.00, 03/04, page 592 of 660 ckio a12 or a11 rd/ dqmxx cke (high) a25 to a16 a15 to a0 tr trw trw tc1 tcw td1 (tpc) (tpc) d31 to d0 t ad t ad t ad t ad t csd3 t rwd t dqmd t rdh2 t bsd t bsd t rds2 t csd3 t rwd t rasd t dqmd t rasd t casd t casd t ad t ad t ad t ad dackn t dakd1 t dakd1 row address row address row address column address read a command figure 24.23 synchronous dram read bus cycle (rcd = = = = 2, cas latency = = = = 2, tpc = = = = 1)
rev. 4.00, 03/04, page 593 of 660 ckio a12 or a11 rd/ dqmxx cke (high) a25 to a16 a15 to a0 tr tc1 tc2/td1 tc3/td2 tc4/td3 td4 (tpc) (tpc) d31 to d0 t ad t ad t ad t ad t ad t ad t ad t ad t ad t csd3 t csd3 t rwd t rwd t rasd t dqmd t bsd t bsd t rds2 t rdh2 t rds2 t rdh2 t dqmd t rasd t casd t casd t dakd1 t dakd1 dackn column address (1-4) read command row address row address row address read a command figure 24.24 synchronous dram read bus cycle (burst read (single read 4), rcd = = = = 0, cas latency = = = = 1, tpc = = = = 1)
rev. 4.00, 03/04, page 594 of 660 ckio a12 or a11 rd/ dqmxx cke a25 to a16 a15 to a0 tr trw tc1 tc2 tc3 tc4/td1 td2 td3 td4 (tpc) d31 to d0 (read) t ad t ad t ad t ad t ad t ad t ad t ad t ad t ad t csd3 t rwd t dqmd t rds2 t bsd t bsd t rdh2 t rds2 t rdh2 t csd3 t rwd t rasd t rasd t casd t dqmd t casd (high) column address (1-4) t dakd1 t dakd1 dackn row address row address row address read command figure 24.25 synchronous dram read bus cycle (burst read (single read 4), rcd = = = = 1, cas latency = = = = 3, tpc = = = = 0)
rev. 4.00, 03/04, page 595 of 660 ckio a12 or a11 rd/ dqmxx cke a25 to a16 a15 to a0 tr tc1 (trwl) (tpc) (high) d31 to d0 t ad column address t ad t ad t csd3 t rwd t rasd t ad t ad t ad t ad t ad t csd3 t rwd t rwd t rasd t casd t dqmd t wdd2 t bsd t dqmd t wdh2 t bsd t casd t dakd1 t dakd1 dackn row address row address row address write a command figure 24.26 synchronous dram write bus cycle (rcd = = = = 0, tpc = = = = 0, trwl = 0)
rev. 4.00, 03/04, page 596 of 660 ckio a12 or a11 rd/ dqmxx cke a25 to a16 a15 to a0 tr trw trw tc1 (trwl) (trwl) (tpc) (tpc) (high) d31 to d0 t ad t ad t ad t ad t ad t ad t ad t csd3 t rwd t rwd t ad t ad t ad t csd3 t rwd t rasd t rasd t dqmd t wdd2 t bsd t casd t dqmd t wdh2 t bsd t casd t dakd1 t dakd1 dackn row address row address row address column address write a command figure 24.27 synchronous dram write bus cycle (rcd = = = = 2, tpc = = = = 1, trwl = 1)
rev. 4.00, 03/04, page 597 of 660 ckio a12 or a11 rd/ dqmxx cke a25 to a16 a15 to a0 tr tc1 tc2 tc3 tc4 (trwl) (tpc) (tpc) (high) d31 to d0 t ad t ad t ad t ad t ad t csd3 t rwd t rwd t ad t ad t ad t ad t csd3 t rwd t rasd t rasd t dqmd t wdd2 t wdd2 t bsd t casd t dqmd t wdh2 t bsd t casd column address (1-4) t dakd1 t dakd1 dackn write a command row address row address row address write command figure 24.28 synchronous dram write bus cycle (burst mode (single write 4), rcd = = = = 0, tpc = = = = 1, trwl = 0)
rev. 4.00, 03/04, page 598 of 660 ckio a12 or a11 rd/ dqmxx cke (high) a25 to a16 a15 to a0 tr trw tc1 tc2 tc3 td4 (trwl) (tpc) d31 to d0 write command column address (1-4) t ad t ad t ad t ad t ad t ad t ad t ad t ad t csd3 t csd3 t rwd t rwd t rwd t rasd t dqmd t bsd t bsd t wdd2 t wdd2 t wdh2 t dqmd t rasd t casd t casd t dakd1 t dakd1 dackn row address row address row address write a command figure 24.29 synchronous dram write bus cycle (burst mode (single write 4), rcd = = = = 1, tpc = = = = 0, trwl = 0)
rev. 4.00, 03/04, page 599 of 660 ckio a12 or a11 rd/ wr csn ras cas bs dqmxx cke a25 to a16 a15 to a0 tnop tc1 tc2/td1 tc3/td2 tc4/td3 td4 d31 to d0 t ad t ad t csd3 t csd3 t rwd t rwd t rasd2 t dqmd t dqmd t bsd t bsd (high) t ad t ad t ad t rds2 t rdh2 t rds2 t rdh2 t casd2 t casd2 t ad row address read command column address t dakd1 t dakd1 dackn figure 24.30 synchronous dram burst read bus cycle (ras down, same row address, cas latency = 1)
rev. 4.00, 03/04, page 600 of 660 a25 to a16 (high) t ad t ad t ad t casd t csd3 t rwd t dqmd t bsd t rdh2 t rds2 t rdh2 t rds2 t bsd t rasd t casd t dqmd t rwd t csd3 t ad t ad t ad tc1 tc2 tc3/td1 tc4/td2 td3 td4 ckio a12 or a11 a15 to a0 csn rd/ wr ras cas dqmxx d31 to d0 bs cke row address dackn t dakd1 t dakd1 column address read command figure 24.31 synchronous dram burst read bus cycle (ras down, same row address, cas latency = 2)
rev. 4.00, 03/04, page 601 of 660 ckio a12 or a11 rd/ dqmxx cke a25 to a16 a15 to a0 tp tr tc1 tc2/td1 tc3/td2 tc4/td3 td4 d31 to d0 t ad t ad t csd3 t csd3 t rwd t rwd t rwd t rasd t rasd t dqmd t dqmd t dqmd t bsd t bsd t dakd1 t dakd1 (high) t ad t ad t ad t ad t ad t ad t rds2 t rdh2 t rds2 t rdh2 t ad row address read command row address row address column address t casd t casd dackn figure 24.32 synchronous dram burst read bus cycle (ras down, different row address, tpc = 0, rcd = 0, cas latency = 1)
rev. 4.00, 03/04, page 602 of 660 ckio a12 or a11 rd/ dqmxx cke a25 to a16 a15 to a0 tp tpw tr tc1 tc2/td1 tc3/td2 tc4/td3 d31 to d0 t ad t ad t csd3 t csd3 t rwd t rwd t rwd t rasd t rasd t rasd t rasd t dqmd t dqmd t dqmd t bsd t bsd (high) t ad t ad t ad t ad t ad t ad t rds2 t rdh2 t rds2 t rdh2 t ad td4 row address read command column address t casd t casd row address row address t dakd1 t dakd1 dackn figure 24.33 synchronous dram burst read bus cycle (ras down, different row address, tpc = 1, rcd = 0, cas latency = 1)
rev. 4.00, 03/04, page 603 of 660 ckio a12 or a11 rd/ dqmxx cke a25 to a16 a15 to a0 tc1 tc2 tc3 tc4 d31 to d0 t ad t ad t csd3 t csd3 t rwd t rwd t rasd t rasd t dqmd t dqmd t wdd2 t wdd2 t bsd t bsd (high) t ad t ad t ad t casd t casd t ad row address write command column address t dakd1 t dakd1 dackn figure 24.34 synchronous dram burst write bus cycle (ras down, same row address)
rev. 4.00, 03/04, page 604 of 660 t wdd2 t wdd2 ckio a12 or a11 rd/ dqmxx cke a25 to a16 a15 to a0 tp tr tc1 tc2 tc3 tc4 d31 to d0 t ad t ad t csd3 t csd3 t rwd t rwd t rwd t rwd t rasd t rasd t dqmd t dqmd t dqmd t bsd t bsd (high) t ad t ad t ad t ad t ad t ad t ad row address write command row address row address column address t casd t casd t dakd1 t dakd1 dackn figure 24.35 synchronous dram burst write bus cycle (ras down, different row address, tpc = 0, rcd = 0)
rev. 4.00, 03/04, page 605 of 660 ckio a12 or a11 rd/ dqmxx cke a25 to a16 a15 to a0 tp tpw tr trw tc1 tc2 tc3 d31 to d0 t ad t ad t csd3 t csd3 t rwd t rwd t rwd t rwd t rasd t rasd t rasd t rasd t dqmd t dqmd t dqmd t wdd2 t wdd2 t bsd t bsd (high) t ad t ad t ad t ad t ad t ad td4 write command column address t casd t casd row address row address t ad t ad row address t dakd1 t dakd1 dackn figure 24.36 synchronous dram burst write bus cycle (ras down, different row address, tpc = 1, rcd = 1)
rev. 4.00, 03/04, page 606 of 660 ckio rd/ cke tp tpc trr trrw trrw (tpc) (tpc) trrw t csd3 t csd3 t rasd t rasd t rasd t rasd t casd t casd t rwd t rwd (high) figure 24.37 synchronous dram auto-refresh timing (tras = 1, tpc = 1) tpc tra1 (trs2) (trs2) trs3 ckio cke rd/ t rwd t rwd t casd t rasd t casd t csd3 t rasd tp t csd3 t rasd t rasd (tpc) (tpc) t cked t cked t rwd figure 24.38 synchronous dram self-refresh cycle (tpc = = = = 0)
rev. 4.00, 03/04, page 607 of 660 ckio a12 or a11 rd/ d31 to d0 a13 or a10 a10 to a2 or a9 to a2 trp1 trp2 trp3 trp4 tmw1 tmw2 tmw3 tmw4 (high) cke t ad t ad t ad t ad t ad t ad t ad t ad t ad t ad t ad t csd3 t csd3 t rwd t rwd t rwd t rasd t rasd t rasd t rasd t casd t casd t dakd1 t dakd1 dackn figure 24.39 synchronous dram mode register write cycle
rev. 4.00, 03/04, page 608 of 660 24.3.7 pcmcia timing t pcm1 t pcm2 ckio a25 to a0 cexx rd/ wr rd d15 to d0 we1 d15 to d0 bs dackn t ad t ad t csd1 t csd1 t rwd t rsd t rsd t rwd t dakd1 t dakd1 t wed t wdd1 t wed t rds1 t rdh1 t bsd t bsd t wdh4 t wdh1 (read) (read) (write) (write) figure 24.40 pcmcia memory bus cycle (ted = 0, teh = 0, no wait)
rev. 4.00, 03/04, page 609 of 660 ckio t pcm0 t pcm0w t pcm1 t pcm1w t pcm1w t pcm2 t pcm2w a25 to a0 rd/ (read) d15 to d0 (read) (write) d15 to d0 (write) dackn t ad t csd1 t rwd t ad t csd1 t rwd t wdh4 t rsd t rsd t dakd1 t dakd1 t wed t wdd1 t wed t wdh1 t rdh1 t bsd t wts t wth t wts t wth t rds1 t bsd figure 24.41 pcmcia memory bus cycle (ted=2,teh=1,onewait,externalwait)
rev. 4.00, 03/04, page 610 of 660 ckio t pcm1 t pcm2 t pcm1 t pcm2 t pcm1 t pcm2 t pcm1 t pcm2 a25 to a4 a3 to a0 cexx rd/ wr rd d15 to d0 bs dackn t ad t ad t csd1 t rwd t csd1 t rwd t ad t ad t ad t ad t dakd1 t rsd t rsd t rdh1 t rdh1 t rsd t rsd t bsd t bsd t bsd t bsd t rds1 t rds1 note: even though burst mode is set, write cycle operation is the same as in normal mode. (read) (read) t dakd1 figure 24.42 pcmcia memory bus cycle (burst read, ted = 0, teh = 0, no wait)
rev. 4.00, 03/04, page 611 of 660 ckio t pcm0 t pcm1 t pcm1w t pcm1w t pcm1w t pcm2 t pcm1 t pcm1w t pcm2 t pcm2w a25 to a4 a3 to a0 cexx rd/ wr rd (read) d15 to d0 (read) bs dackn wait t ad t ad t csd1 t rwd t csd1 t dakd1 t rwd t ad t ad t ad t rsd t rsd t rsd t rsd t dakd1 t bsd t bsd t bsd t bsd t rds1 t rdh1 t rdh1 t rds1 t wts t wth t wts t wts t wth t wth note: even though burst mode is set, the write cycle operation is the same as in normal mode. figure 24.43 pcmcia memory bus cycle (burstread,ted=1,teh=1,twowaits,burstpitch=3)
rev. 4.00, 03/04, page 612 of 660 t pci1 t pci2 ckio a25 to a0 cexx rd/ wr iciord (read) d15 to d0 (read) iciowr (write) d15 to d0 (write) bs dackn t ad t ad t csd1 t csd1 t rwd t icrsd t icrsd t rwd t dakd1 t dakd1 t icwsd t wdd1 t icwsd t rdh1 t rds1 t bsd t bsd t wdh1 t wdh4 figure 24.44 pcmcia i/o bus cycle (ted = 0, teh = 0, no wait)
rev. 4.00, 03/04, page 613 of 660 ckio t pci0 t pci0w t pci1 t pci1w t pci1w t pci2 t pci2w a25 to a0 cexx rd/ wr iciord (read) d15 to d0 (read) iciowr (write) d15 to d0 (write) bs dackn wait iois16 t ad t csd1 t rwd t ad t csd1 t rwd t icrsd t icrsd t dakd1 t dakd1 t icwsd t wdd1 t icwsd t wdh1 t wdh4 t rdh1 t bsd t bsd t wts t wth t wts t wth t io16s t io16h t rds1 figure 24.45 pcmcia i/o bus cycle (ted=2,teh=1,onewait,externalwait)
rev. 4.00, 03/04, page 614 of 660 ckio t pci0 t pci1 t pci1w t pci2 t pci1 t pci1w t pci2 t pci2w a25 to a4 a0 cexx rd/ wr iciord d15 to d0 iciowr d15 to d0 bs wait iois16 dackn t ad t ad t csd1 t csd1 t rwd t rwd t wdd1 t wdh4 t bsd t ad t ad t icrsd t icrsd t icrsd t icrsd t icwsd t wts t wth t wth t io16s t io16h t ad t rds1 t csd1 t dakd1 t dakd1 t rds1 t icwsd t icwsd t rdh1 t rdh1 t wdh1 t bsd t wts (read) (read) (write) (write) t bsd t bsd t wdh3 t wdd2 t icwsd figure 24.46 pcmcia i/o bus cycle (ted = 1, teh = 1, one wait, bus sizing)
rev. 4.00, 03/04, page 615 of 660 24.3.8 peripheral module signal timing table 24.8 peripheral module signal timing module item symbol min max unit figure timer input setup time t tclks 15 ? 24.47 timer clock input setup time t tcks 15 ? ns timer clock edge specification t tckwh 1.5 ? pulse width both edge specification t tckwl 2.5 ? tcyc 24.48 tmu, rtc oscillation settling time t rosc ? 3 s 24.44 asynchronization 4 ? input clock cycle clock synchronization t scyc 6? 24.50, 24.51 input clock rise time t sckr ?1.5 input clock fall time t sckf ?1.5 tcyc input clock pulse width t sckw 0.4 0.6 tscyc 24.50 transmission data delay time t txd ? 100 receive data setup time (clock synchronization) t rxs 100 ? receive data hold time (clock synchronization) t rxh 100 ? rts delay time t rtsd ? 100 cts setup time (clock synchronization) t ctss 100 ? sci cts hold time (clock synchronization) t ctsh 100 ? ns 24.51 output data delay time t portd ?17 input data setup time 1 t ports1 15 ? input data hold time 1 t porth1 8? input data setup time 2 t ports2 tcyc+ 15 ? input data hold time 2 t porth2 8? input data setup time 3 t ports3 3 tcyc +15 ? port input data hold time 3 t porth3 8? ns 24.52 dreq setup time t dreq 6? dreq hold time t dreqh 4? 24.53 dmac drak delay time t drakd ?10 ns 22.54
rev. 4.00, 03/04, page 616 of 660 t tclks ckio tclk (input) figure 24.47 tclk input timing t tcks t tcks t tckwh t tckwl ckio tclk (input) figure 24.48 tclk clock input timing rtc crystal oscillator stable oscillation v cc v cc min t rosc figure 24.49 oscillation settling time at rtc crystal oscillator power-on t sckw t sckr t sckf t scyc sck figure 24.50 sck input clock timing
rev. 4.00, 03/04, page 617 of 660 t scyc t txd sck txd (data trans- missiion) rxd (data reception) t rxh t rxs t rtsd t ctsh t ctss figure 24.51 sci i/o timing in clock synchronous mode t ports1 ckio t porth1 t ports2 t porth2 t portd t ports3 t porth3 port 7 to 0 (read) (b:p clock ratio = 1:1) port 7 to 0 (read) (b:p clock ratio = 2:1) port 7 to 0 (read) (b:p clock ratio = 4:1) port 7 to 0 (write) figure 24.52 i/o port timing ckio t drqs t drqh figure 24.53 dreq dreq dreq dreq input timing
rev. 4.00, 03/04, page 618 of 660 drak0/1 ckio t drakd t drakd figure 24.54 drak output timing 24.3.9 h-udi, aud related pin timing table 24.9 h-udi, aud related pin timing item symbol min max unit figure tck cycle time t tckcyc 50 ? ns tck high pulse width t tckh 12 ? ns tck low pulse width t tckl 12 ? ns tck rise/fall time t tckf ?4 ns 24.55 trst setup time t trsts 12 ? ns trst hold time t trsth 50 ? t cyc 24.56 tdi setup time t tdis 10 ? ns tdi hold time t tdih 10 ? ns tms setup time t tmss 10 ? ns tms hold time t tmsh 10 ? ns tdo delay time t tdod ?16ns 24.57 asemd0 setup time t asemdh 12 ? ns asemd0 hold time t asemds 12 ? ns 24.58 audck cycle time t audcyc ? 66 ms 24.59 audata delay time t audd ?12ns audsync delay time t ausyd ?12ns
rev. 4.00, 03/04, page 619 of 660 t tckl t tckf v il v il v ih v ih v ih 1/2v cc q 1/2v cc q note: when clock is input from tck pin t tckf t tckh t tckcyc figure 24.55 tck input timing resetp t trsts t trsth trst figure 24.56 trst input timing (reset hold) tck tdi tms t tdis t tmss t tdih t tckcyc t tmsh t tdod tdo figure 24.57 h-udi data transfer timing
rev. 4.00, 03/04, page 620 of 660 t asemdos t asemdoh resetp asemd0 figure 24.58 asemd0 asemd0 asemd0 asemd0 input timing audck audata audsync t audd t audd t ausyd t audcyc figure 24.59 aud timing 24.3.10 a/d converter timing table 24.10 a/d converter timing item symbol min typ max unit figure external trigger input pulse width t trgw 2??tcyc external trigger input start delay time t trgs 50 ? ? ns 24.60 (cks = 0) ? 129 ? input sampling time (cks = 1) t spl ?65? tcyc (cks = 0) 17 ? 28 a/d conversion start delay time (cks = 1) t d 10 ? 17 tcyc (cks = 0) 514 ? 525 a/d conversion time (cks = 1) t conv 259 ? 266 tcyc 24.61 tcyc: p cycle
rev. 4.00, 03/04, page 621 of 660 ck input adcr 1 state t trgw t trgs figure 24.60 external trigger input timing p write signal adf * 1 input sampling timing t d : a/d conversion start delay t spl : input sampling time t conv : a/d conversion time notes: 1. adcsr write cycle 2. adcsr address address * 2 t d t spl t conv figure 24.61 a/d conversion timing
rev. 4.00, 03/04, page 622 of 660 24.3.11 ac characteristics measurement conditions ? i/o signal reference level: vccq/2 (vccq = 3.3 0.3 v, vcc = 1.9 0.15 v) ? input pulse level: vssq to 3.0 v (where resetp , resetm , asemd0 , adtrg , trst ,ca, nmi, irq5 to irq0 , ckio, and md5 to md0 are within vssq to vccq) ? input rise and fall times: 1 ns i ol i oh c l v ref lsi output pin dut output notes: c l is the total value that includes the capacitance of measurement instruments, etc., and is set as follows for each pin. 30 pf: ckio, rasx , casxx , cs0 , cs2 to cs6 , ce2a , ce2b , back 50 pf: all other pins i ol and i oh are the values shown in table 23.3. 1. 2. figure 24.62 output load circuit
rev. 4.00, 03/04, page 623 of 660 24.3.12 delay time variation due to load capacitance a graph (reference data) of the variation in delay time when a load capacitance greater than that stipulated (30 pf) is connected to this lsi's pins is shown below. the graph shown in figure 24.63 should be taken into consideration in the design process if the stipulated capacitance is exceeded in connecting an external device. if the connected load capacitance exceeds the range shown in figure 24.63 the graph will not be a straight line. +3 +2 +1 +0 +0 +10 +20 +30 +40 +50 load capacitance [pf] delay time [ns] figure 24.63 load capacitance vs. delay time
rev. 4.00, 03/04, page 624 of 660 24.4 a/d converter characteristics table 24.11 lists the a/d converter characteristics. table 24.11 a/d converter characteristics (vccq = 3.3 0.3 v, vcc = 1.9 0.15 v, avcc = 3.3 0.3 v, ta = ?20 to 75c) item min typ max unit resolution 10 10 10 bits conversion time 15 ? ? s analog input capacitance ? ? 20 pf permissible signal-source (single- source) impedance ??5 k ? nonlinearity error ? ? 3.0 lsb offset error ? ? 2.0 lsb full-scale error ? ? 2.0 lsb quantization error ? ? 0.5 lsb absolute accuracy ? ? 4.0 lsb 24.5 d/a converter characteristics table 24.12 lists the d/a converter characteristics. table 24.12 d/a converter characteristics (vccq = 3.3 0.3 v, vcc = 1.9 0.15 v, avcc = 3.3 0.3 v, ta = ?20 to 75c) item min typ max unit test conditions resolution 888bits conversion time ? ? 10.0 s 20-pf capacitive load absolute accuracy ? 2.5 4.0 lsb 2-m ? resistance load
rev. 4.00, 03/04, page 625 of 660 appendix a. equivalent circuits of i/o buffer for each pin circuit function pin name input data input enable input with enable wait breq input data input enable pull-up enable vccq input with enable pull-up with enable rxd0/scpt[0] rxd2/scpt[2] audck/ptg[4] input data schmitt trigger input asemd0 md[5:0] reserm nmi resetp ca input data pull-up enable input data input enable vccq input with enable schmitt trigger input pull-up with enable cts2/irq5/scpt[5] adtrg/ptg[5]
rev. 4.00, 03/04, page 626 of 660 circuit function pin name input data input enable input enable input analog data input with enable analog input with enable an[1:0]/ptj[1:0] input data input enable input enable input analog data output enable output analog data input with enable analog input with enable analog output with enable an[3:2]/da[0:1]/ptj[3:2] output data output enable vccq vssq 3-state output rd we0 / dqmll we1 / dqmlu / we cs0 back txd0/scpt[0] txd2/scpt[2] output data output enable vccq vccq vssq pull-up enable 3-state output pull-up with enable a[25:12]
rev. 4.00, 03/04, page 627 of 660 circuit function pin name output data output enable vccq vssq input data input enable pull-up enable vccq 3-state output input with enable pull-up with enable d[31:24]/ptb[7:0] d[23:16]/pta[7:0] d[15:0] a[11:0] bs /ptc[0] we2 / dqmul / iciord /ptc[1] we3 / dqmuu / iciowr /ptc[2] cs[4:2] /ptc[5:3] cs5 / ce1a /ptc[6] cs6 / ce1b /ptc[7] ce2a /ptd[6] ce2b /ptd[7] rasl /ptd[0] rasu /ptd[1] casl /ptd[2] casu /ptd[3] cke/ptd[4] iois16 /ptd[5] dack[1:0]/pte[1:0] drak[1:0]/pte[3:2] audata[3:0]/ptf[3:0] audsync /ptf[4] tdo/ptf[5] asebrkak /ptf[6] status[1:0]/pte[5:4] tclk/pte[6] irqout /pte[7] sck0/scpt[1] sck2/scpt[3] rts2 /scpt[4] dreq[1:0] /pth[6:5] output data output enable vccq vssq input data input enable 3-state output input with enable rd/ wr ckio
rev. 4.00, 03/04, page 628 of 660 circuit function pin name output enable output data vccq vssq input data input data input enable pull-up enable vccq 3-state output input with enable schmitt trigger input pull-up with enable tdi/ptg[0] tck/ptg[1] tms/ptg[2] trst/ptg[3] irq[3:0]/ irl[3:0] /pth[3:0] irq4/pth[4] clock out xtal2 extal2 clock enable 32-khz crystal oscillation input extal2 clock out xtal extal clock enable select switch between crystal resonator and crystal oscillator input (input from extal) extal
rev. 4.00, 03/04, page 629 of 660 b. pin functions b.1 pin functions table b.1 shows pin states during resets, power-down states, and the bus-released states. table b.1 pin states during resets, power-down states, and bus-released state reset power-down category pin power-on reset manual reset standby sleep bus released extal i i i i i xtal o * 1 o * 1 o * 1 o * 1 o * 1 ckio io * 1 io * 1 io * 1 io * 1 io * 1 extal2 i i i i i xtal2 o o o o o clock cap1, cap2 ? ? ? ? ? resetp i iiii resetm i iiii breq iiii back o oool md[5:0] i i i i i ca i i i i system control status[1:0]/pte[5:4] o op * 3 op * 3 op * 3 op * 3 irq[3:0]/ irl[3:0] / pth[3:0] i * 8 iiii irq4/ pth[4] i * 8 iiii nmi i iiii tck/ptg[1] iv i iz i i tdi/ptg[0] iv i iz i i tms/ptg[2] iv i iz i i trst /ptg[3] iv i iz i i interrupt irqout /pte[7] h op * 3 zk * 3 op * 3 op * 3 address bus a[25:0] z o zl * 10 oz
rev. 4.00, 03/04, page 630 of 660 reset power-down category pin power-on reset manual reset standby sleep bus released d[15:0] z i z io z d[23:16]/pta[7:0] z ip * 3 zk * 3 iop * 3 zp * 3 data bus d[31:24]/ptb[7:0] z ip * 3 zk * 3 iop * 3 zp * 3 cs0 hozh * 11 oz cs[2:4] /ptc[5:3] h op * 3 zh * 11 k * 3 op * 3 zp * 3 cs5 / ce1a /ptc[6] h op * 3 zh * 11 k * 3 op * 3 zp * 3 cs6 / ce1b /ptc[7] h op * 3 zh * 11 k * 3 op * 3 zp * 3 bs /ptc[0] h op * 3 zh * 11 k * 3 op * 3 zp * 3 rasl /ptd[0] h op * 3 zok * 4 op * 3 zop * 4 rasu /ptd[1] h op * 3 zok * 4 op * 3 zop * 4 casl /ptd[2] h op * 3 zok * 4 op * 3 zop * 4 casu /ptd[3] h op * 3 zok * 4 op * 3 zop * 4 we0 / dqmll hozh * 11 oz we1 / dqmlu / we hozh * 11 oz we2 / dqmul / iciord / ptc[1] hop * 3 zh * 11 k * 3 op * 3 zp * 3 we3/ dqmuu / iciowr / ptc[2] hop * 3 zh * 11 k * 3 op * 3 zp * 3 rd/ wr hozh * 11 oz rd hozh * 11 oz cke/ptd[4] h op * 3 ok * 3 op * 3 op * 3 bus control wait ziziz dreq0 /pth[5] i zi * 7 zi i dack0/pte[0] o op * 3 zk * 3 op * 3 op * 3 drak0/pte[2] o op * 3 zh * 11 k * 3 op * 3 op * 3 dreq1 /pth[6] i zi * 7 zi i dack1/pte[1] o op * 3 zk * 3 op * 3 op * 3 dmac drak1/pte[3] o op * 3 zh * 11 k * 3 op * 3 op * 3 timer tclk/pte[6] i zi * 7 iop * 5 iop * 5 iop * 5
rev. 4.00, 03/04, page 631 of 660 reset power-down category pin power-on reset manual reset standby sleep bus released rxd0/scpt[0] z zi * 7 ziz * 6 iz * 6 txd0/scpt[0] z zo * 7 zk * 3 oz * 6 oz * 6 sci/smart card without fifo sck0/scpt[1] v zp * 3 zk * 3 iop * 5 iop * 5 rxd2/scpt[2] z zi * 7 ziz * 6 iz * 6 txd2/scpt[2] z zo * 7 zk * 3 oz * 6 oz * 6 sck2/scpt[3] v zp * 3 zk * 3 iop * 5 iop * 5 rts2 /scpt[4] v op * 3 zk * 3 op * 3 op * 3 scif with fifo cts2 /irq5/scpt[5] v * 8 zi * 7 iii audsync /ptf[4] ov op * 3 ok * 3 op * 3 op * 3 ce2b /ptd[7] h op * 3 zh * 11 k * 3 op * 3 zp * 3 ce2a /ptd[6] h op * 3 zh * 11 k * 3 op * 3 zp * 3 tdo/ptf[5] ov op * 3 ok * 3 op * 3 op * 3 iois16 /ptd[5] i i z i i audck/ptg[4] iv i iz i i adtrg /ptg[5] v * 8 iizii audata[3:0]/ptf[3:0] iv i iz i i asebrkak /ptf[6] ov op * 3 op * 3 op * 3 op * 3 port asemd0 iizii an[1:0]/ptj[1:0] z zi * 7 zi i analog an[3:2]/da[0:1]/ ptj[3:2] zzi * 7 oz * 2 io * 9 io * 9 legend i: input o: output h: high-level output l: low-level output z: high impedance p: input or output depending on register setting k: input pin is high impedance, output pin holds the state v: i/o buffer off, pullup mos on notes: 1. depending on the clock mode (md2 to md0 setting) 2. 0 when da output is enabled: otheruise z. 3. k or p when the port function is used. 4. k or p when the port function is used. z or o when the port function is not used depending on register setting.
rev. 4.00, 03/04, page 632 of 660 5. k or p when the port function is used. i or o when the port function is not used depending on register setting. 6. depending on register setting 7. i or o when the port function is used. 8. input schmitt buffers of irq[5:0] and adtrg are on. input schmitt buffers of the other inputs (e.g. pth, cts2) that are shared with these pins are off. 9. o when da output is enabled; otherwise depends on a register setting. 10. in the standby mode, z or l depending on register setting. 11. in the standby mode, z or h depending on register setting.
rev. 4.00, 03/04, page 633 of 660 b.2 pin specifications table b.2 shows the pin specifications. table b.2 pin specifications number of pins pin fp-176c tbp-208a i/o function md0 163 d8 i clock mode setting md1 129 c17 i clock mode setting md2 164 b7 i clock mode setting md3 167 c6 i area 0 bus width setting md4 168 d6 i area 0 bus width setting md5 169 a5 i endian setting d31tod24/ ptb[7] to ptb[0] 5, 6, 7, 8, 9, 10, 12, 14 f4, f3, f2, f1, g4, g3, g1, h3 i/o data bus / input/output port b d23tod16/ pta[7] to pta[0] 15, 16, 17, 18, 20, 22, 23, 24 h2,h1,j4,j2, j3, k2, k3, k4 i/o data bus / input/output port a d15 to d0 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 40, 41, 42, 43, 44 l2, l4, m1, m2, m3, m4, n1, n2, n3,n4,p2,r1, r2,p4,t1,t2 i/o data bus a25 to a0 76, 75, 74, 72, 70, 69, 68, 67, 66, 65, 64, 62, 60, 59, 58, 57, 56, 55, 54, 53, 52, 50, 48, 47, 46, 45 t11, p10, t10, r9,t9,p9,u8, t8,r8,p8,u7, r7, u6, t6, r6, p6,u5,t5,r5, p5,u4,r4,t3, r3, u2, u1 o address bus bs /ptc[0] 77 r11 o / i/o bus cycle start signal / input/output port c rd 78 p11 o read strobe we0 / dqmll 79 u12 o d7 to d0 select signal / dqm (sdram) we1 / dqmlu / we 80 t12 o d15 to d8 select signal / dqm (sdram) / write strobe (pcmcia) we2 / dqmul / iciord /ptc[1] 81 r12 o/o/ o/i/o d23 to d16 select signal / dqm (sdram) / pcmcia input/output read / input/output port c we3 / dqmuu / iciowr /ptc[2] 82 p12 o/o/ o/i/o d31 to d24 select signal / dqm (sdram) / pcmcia input/output write / input/output port c rd/ wr 83 u13 o read/write cs0 85 p13 o chip select
rev. 4.00, 03/04, page 634 of 660 number of pins pin fp-176c tbp-208a i/o function cs2 /ptc[3] 87 t14 o / i/o chip select 2 / input/output port c cs3 /ptc[4] 88 r14 o / i/o chip select 3 / input/output port c cs4 /ptc[5] 89 u17 o / i/o chip select 4 / input/output port c cs5 / ce1a /ptc[6] 90 t17 o / o / i/o chip select 5 / ce1 (area 5 pcmcia) / input/output port c cs6 / ce1b /ptc7] 91 r15 o / o / i/o chip select 6 / ce1 (area 6 pcmcia) / input/output port c ce2a /ptd[6] 92 r16 o / i/o area 5 pcmcia ce2 / input/output port d ce2b /ptd[7] 94 p15 o / i/o area 6 pcmcia ce2 / input/output port d rasl /ptd[0] 96 p17 o / i/o lower 32 mbytes address ras (sdram) / input/output port d rasu /ptd[1] 97 n14 o / i/o upper 32 mbytes address ras (sdram) / input/output port d casl /ptd[2] 98 n15 o / i/o lower 32 mbytes address cas (sdram) / input/output port d casu /ptd[3] 99 n16 o / i/o upper 32 mbytes address cas (sdram) / input/output port d cke/ptd[4] 100 n17 o / i/o ck enable (sdram) / input/output port d iois16 /ptd[5] 101 m14 i / i/o iois16 (pcmcia) / input port d back 102 m15 o bus acknowledge breq 103 m16 i bus request wait 104 m17 i hardware wait request dack0/pte[0] 105 l14 o / i/o dma acknowledge 0 / input/output port e dack1/pte[1] 106 l15 o / i/o dma acknowledge 1 / input/output port e drak0/pte[2] 107 l16 o / i/o dma request acknowledge / input/output port e drak1/pte[3] 108 l17 o / i/o dma request acknowledge / input/output port e audata[0]/ptf[0] 109 k15 i/o aud data / input/output port f audata[1]/ptf[1] 110 k16 i/o aud data / input/output port f audata[2]/ptf[2] 111 k17 i/o aud data / input/output port f audata[3]/ptf[3] 112 j14 i/o aud data / input/output port f audsync /ptf[4] 113 j16 o / i/o aud synchronous / input/output port f tdi/ptg[0] 114 j17 i data input (h-udi) / input port g tck/ptg[1] 116 h17 i clock (h-udi) / input port g tms/ptg[2] 118 g16 i mode select (h-udi) / input port g trst /ptg[3] 119 g15 i reset (h-udi) / input port g tdo/ptf[5] 120 g14 o / i/o data output (h-udi) / input/output port f
rev. 4.00, 03/04, page 635 of 660 number of pins pin fp-176c tbp-208a i/o function asebrkak /ptf[6] 121 f16 o / i/o ase break acknowledge (h-udi) / input/output port f asemdo 122 f15 i ase mode (h-udi) cap1 124 e16 ? pll1 external capacitance pin cap2 127 d17 ? pll2 external capacitance pin xtal 131 b17 o clock oscillator pin extal 132 b16 i external clock / crystal oscillator pin xtal 2 c2 o on-chip rtc crystal oscillator pin extal2 3 c1 i on-chip rtc crystal oscillator pin status0/pte[4] 133 a17 o / i/o processor status / input/output port e status1/pte[5] 134 a16 o / i/o processor status / input/output port e tclk/pte[6] 135 c15 i/o tmu or rtc clock input/output / input/output port e irqout /pte[7] 136 b15 o / i/o interrupt request notification / input/output port e ckio 138 c14 i/o system clock input/output txd0/scpt[0] 140 a14 o sci transmit data 0 / sc port txd2/scpt[2] 142 c13 o scif transmit data 2 / sc port sck0/scpt[1] 141 d13 i/o sci clock 0 / sc port sck2/scpt[3] 143 b13 i/o scif clock 2 / sc port rxd0/scpt[0] 145 d12 i sci receive data 0 / sc port rxd2/scpt[2] 146 c12 i scif receive data 2 / sc port rts2 /scpt[4] 144 a13 o / i/o scif transmit request 2 / sc port cts2 /irq5/ scpt[5] 147 b12 i scif transmit clear / external interruption request / sc port resetm 149 c11 i manual reset request irq[3:0]/ irl [3:0]/ pth[[3:0]] 151, 152, 153, 154 a11, d10, c10, b10 i / i / i/o external interrupt request / input/output port h irq4/pth[4] 155 a10 i / i/o external interrupt request / input/output port h nmi 157 b9 i nonmaskable interrupt request audck/ptg[4] 159 c9 i aud clock / input port g resetp 165 a6 i power-on reset request ca 166 b6 i chip activate / hardware standby request an[0]/ptj[0] 171 c5 i a/d converter input / input port j an[1]/ptj[1] 172 d5 i a/d converter input / input port j an2[2]/da[1]/ptj[2] 173 a4 i / o / i a/d converter input / d/a converter output / input port j an3[3]/da[0]/ptj[3] 174 b4 i / o / i a/d converter input / d/a converter output / input port j
rev. 4.00, 03/04, page 636 of 660 number of pins pin fp-176c tbp-208a i/o function adtrg /ptg[5] 162 c8 i analog trigger / input port g dreq0 /pth[5] 160 a8 i / i/o dma request / input/output port h dreq1 /pth[6] 161 b8 i / i/o dma request / input/output port h v cc q 13, 27, 39, 51, 63, 86, 95, 139, 158 h4, l3, p3, t4, t7, u14, p16, b14, a9 power supply input/output power supply (3.3 v) v cc 21, 73, 117, 150 k1, u10, h16, b11 power supply internal power supply (1.9 v) v cc -rtc 1 c3 power supply rtc power supply (1.9 v) v cc -pll1 123 e17 power supply pll1 power supply (1.9 v) v cc -pll2 128 d16 power supply pll2 power supply (1.9 v) av cc 175 b3 power supply analog power supply (3.3 v) v ss q 11, 25, 37, 49, 61, 84, 93, 137, 156 g2, l1, p1,u3, p7, r13, r17, a15, d9 power supply input/output power supply (0 v) v ss 19, 71, 115, 130, 148 j1, u9, j15, c16, d11 power supply internal power supply (0 v) v ss -rtc 4 d3 power supply rtc power supply (0 v) v ss -pll1 125 e15 power supply pll1 power supply (0 v) v ss -pll2 126 e14 power supply pll2 power supply (0 v) av ss 170, 176 b5, b2 power supply analog power supply (0 v)
rev. 4.00, 03/04, page 637 of 660 b.3 processing of unused pins ? when rtc is not used ? extal2: pullupto(v cc -rtc) ? xtal2: leave unconnected ? v cc ? rtc: power supply (1.9) ? v ss ? rtc: power supply (0 v) ? when pll1 is not used ? cap1: leave unconnected ? v cc ? pll1: power supply (1.9) ? v ss ? pll1: power supply (0 v) ? when pll2 is not used ? cap2: leave unconnected ? v cc ? pll2: power supply (1.9 v) ? v ss ? pll2: power supply (0 v) ? when on-chip crystal oscillator is not used ? xtal: leave unconnected ? when extal pin is not used ? extal: pull up to v cc qorv ss ? when a/d converter is not used ? an[3:0]: leave unconnected ? av cc : power supply (3.3 v) ? av ss : power supply (0 v) ? when hardware standby is not used ? ca: pulluptov cc q
rev. 4.00, 03/04, page 638 of 660 b.4 pin states in access to each address space table b.3 pin states (normal memory/little endian) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs2, cs0 enabled enabled enabled enabled r low low low low rd w high high high high r high high high high rd/wr w low low low low bs enabled enabled enabled enabled rasu/ptd[1] high high high high rasl/ptd[0] high high high high casl/ptd[2] high high high high casu/ptd[3] high high high high r high high high high we0/dqmll w low low high low r high high high high we1/we/dqmlu w high high low low r high high high high we2/iciord/dqmul/ ptc[1] w high high high high r high high high high we3/iciowr/dqmuu/ ptc[2] w high high high high ce2a/ptd[6] high high high high ce2b/ptd[7] high high high high cke disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data valid data invalid data valid data d15tod8 high-z * 2 invalid data valid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2
rev. 4.00, 03/04, page 639 of 660 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled r low low low low low low low rd w high high high high high high high r high high high high high high high rd/ wr w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled rasu /ptd[1] high high high high high high high rasl /ptd[0] high high high high high high high casl /ptd[2] high high high high high high high casu /ptd[3] high high high high high high high r high high high high high high high we0 / dqmll w low high high high low high low r high high high high high high high we1 / we / dqmlu w high low high high low high low r high high high high high high high we2 / iciord / dqmul / ptc[1] w high high low high high low low r high high high high high high high we3 / iciowr / dqmuu / ptc[2] w high high high low high low low ce2a /ptd[6] high high high high high high high ce2b /ptd[7] high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 valid data invalid data invalid data invalid data valid data invalid data valid data d15tod8 invalid data valid data invalid data invalid data valid data invalid data valid data d23tod16 invalid data invalid data valid data invalid data invalid data valid data valid data d31tod24 invalid data invalid data invalid data valid data invalid data valid data valid data notes: 1. disabled when wcr2 register wait setting is 0. 2. unused data pins should be switched to the port function, or pulled up or down.
rev. 4.00, 03/04, page 640 of 660 table b.4 pin states (normal memory/big endian) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs2 , cs0 enabled enabled enabled enabled r low low low low rd w high high high high r high high high high rd/ wr w low low low low bs enabled enabled enabled enabled rasu /ptd[1] high high high high rasl /ptd[0] high high high high casl /ptd[2] high high high high casu /ptd[3] high high high high r high high high high we0 / dqmll w low high low low r high high high high we1 / we / dqmlu w high low high low r high high high high we2 / iciord / dqmul / ptc[1] w high high high high r high high high high we3 / iciowr / dqmuu / ptc[2] w high high high high ce2a /ptd[6] high high high high ce2b /ptd[7] high high high high cke disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data invalid data valid data valid data d15tod8 high-z * 2 valid data invalid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2
rev. 4.00, 03/04, page 641 of 660 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled r low low low low low low low rd w high high high high high high high r high high high high high high high rd/ wr w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled rasu /ptd[1] high high high high high high high rasl /ptd[0] high high high high high high high casl /ptd[2] high high high high high high high casu /ptd[3] high high high high high high high r high high high high high high high we0 / dqmll w high high high low high low low r high high high high high high high we1 / we / dqmlu w high high low high high low low r high high high high high high high we2 / iciord / dqmul / ptc[1] w high low high high low high low r high high high high high high high we3 / iciowr / dqmuu / ptc[2] w low high high high low high low ce2a /ptd[6] high high high high high high high ce2b /ptd[7] high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 invalid data invalid data invalid data valid data invalid data valid data valid data d15tod8 invalid data invalid data valid data invalid data invalid data valid data valid data d23tod16 invalid data valid data invalid data invalid data valid data invalid data valid data d31tod24 valid data invalid data invalid data invalid data valid data invalid data valid data notes: 1. disabled when wcr2 register wait setting is 0. 2. unused data pins should be switched to the port function, or pulled up or down.
rev. 4.00, 03/04, page 642 of 660 table b.5 pin states (burst rom/little endian) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs2 , cs0 enabled enabled enabled enabled r low low low low rd w? ??? r high high high high rd/ wr w? ??? bs enabled enabled enabled enabled rasu /ptd[1] high high high high rasl /ptd[0] high high high high casl /ptd[2] high high high high casu /ptd[3] high high high high r high high high high we0 / dqmll w? ??? r high high high high we1 / we / dqmlu w? ??? r high high high high we2 / iciord / dqmul / ptc[1] w? ??? r high high high high we3 / iciowr / dqmuu / ptc[2] w? ??? ce2a /ptd[6] high high high high ce2b /ptd[7] high high high high cke disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data valid data invalid data valid data d15tod8 high-z * 2 invalid data valid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2
rev. 4.00, 03/04, page 643 of 660 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled r low low low low low low low rd w??????? r high high high high high high high rd/ wr w??????? bs enabled enabled enabled enabled enabled enabled enabled rasu /ptd[1] high high high high high high high rasl /ptd[0] high high high high high high high casl /ptd[2] high high high high high high high casu /ptd[3] high high high high high high high r high high high high high high high we0 / dqmll w??????? r high high high high high high high we1 / we / dqmlu w??????? r high high high high high high high we2 / iciord / dqmul / ptc[1] w??????? r high high high high high high high we3 / iciowr / dqmuu / ptc[2] w??????? ce2a /ptd[6] high high high high high high high ce2b /ptd[7] high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 valid data invalid data invalid data invalid data valid data invalid data valid data d15tod8 invalid data valid data invalid data invalid data valid data invalid data valid data d23tod16 invalid data invalid data valid data invalid data invalid data valid data valid data d31tod24 invalid data invalid data invalid data valid data invalid data valid data valid data notes: 1. disabled when wcr2 register wait setting is 0. 2. unused data pins should be switched to the port function, or pulled up or down.
rev. 4.00, 03/04, page 644 of 660 table b.6 pin states (burst rom/big endian) 8-bit bus width 16-bit bus width pin byte/word/long- word access byte access (address 2n) byte access (address 2n + 1) word/longword access cs6 to cs2 , cs0 enabled enabled enabled enabled r low low low low rd w? ??? r high high high high rd/ wr w? ??? bs enabled enabled enabled enabled rasu /ptd[1] high high high high rasl /ptd[0] high high high high casl /ptd[2] high high high high casu /ptd[3] high high high high r high high high high we0 / dqmll w? ??? r high high high high we1 / we / dqmlu w? ??? r high high high high we2 / iciord / dqmul / ptc[1] w? ??? r high high high high we3 / iciowr / dqmuu / ptc[2] w? ??? ce2a /ptd[6] high high high high ce2b /ptd[7] high high high high cke disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled a25 to a0 address address address address d7 to d0 valid data invalid data valid data valid data d15tod8 high-z * 2 valid data invalid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2
rev. 4.00, 03/04, page 645 of 660 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled r low low low low low low low rd w??????? r high high high high high high high rd/ wr w??????? bs enabled enabled enabled enabled enabled enabled enabled rasu /ptd[1] high high high high high high high rasl /ptd[0] high high high high high high high casl /ptd[2] high high high high high high high casu /ptd[3] high high high high high high high r high high high high high high high we0 / dqmll w??????? r high high high high high high high we1 / we / dqmlu w??????? r high high high high high high high we2 / iciord / dqmul / ptc[1] w??????? r high high high high high high high we3 / iciowr / dqmuu / ptc[2] w??????? ce2a /ptd[6] high high high high high high high ce2b /ptd[7] high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address d7 to d0 invalid data invalid data invalid data valid data invalid data valid data valid data d15tod8 invalid data invalid data valid data invalid data invalid data valid data valid data d23tod16 invalid data valid data invalid data invalid data valid data invalid data valid data d31 to d24 valid data invalid data invalid data invalid data valid data invalid data valid data notes: 1. disabled when wcr2 register wait setting is 0. 2. unused data pins should be switched to the port function, or pulled up or down.
rev. 4.00, 03/04, page 646 of 660 table b.7 pin states (synchronous dram/little endian) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled r high high high high high high high rd w high high high high high high high r high high high high high high high rd/ wr w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled rasu /ptd[1] high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 rasl /ptd[0] low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 casl /ptd[2] high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 casu /ptd[3] low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 r low high high high low high low dqmll / we0 w low high high high low high low r high low high high low high low dqmlu / we1 w high low high high low high low r high high low high high low low dqmul / we2 / iciord w high high low high high low low r high high high low high low low dqmuu / we3 / iciowr w high high high low high low low ce2a /ptd[6] high high high high high high high ce2b /ptd[7] high high high high high high high cke high * 2 high * 2 high * 2 high * 2 high * 2 high * 2 high * 2 wait disabled disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address command address command address command address command address command address command address command d7 to d0 valid data invalid data invalid data invalid data valid data invalid data valid data d15 to d8 invalid data valid data invalid data invalid data valid data invalid data valid data d23 to d16 invalid data invalid data valid data invalid data invalid data valid data valid data d31 to d24 invalid data invalid data invalid data valid data invalid data valid data valid data notes: 1. lower 32-mbyte access/upper 32-mbyte access 2. normally high. low in self-refreshing.
rev. 4.00, 03/04, page 647 of 660 table b.8 pin states (synchronous dram/big endian) 32-bit bus width pin byte access (address 4n) byte access (address 4n + 1) byte access (address 4n + 2) byte access (address 4n + 3) word access (address 4n) word access (address 4n + 2) longword access cs6 to cs2 , cs0 enabled enabled enabled enabled enabled enabled enabled r high high high high high high high rd w high high high high high high high r high high high high high high high rd/ wr w low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled rasu /ptd[1] high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 rasl /ptd[0] low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 casl /ptd[2] high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 high/low * 1 casu /ptd[3] low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 low/high * 1 r high high high low high low low dqmll / we0 w high high high low high low low r high high low high high low low dqmlu / we1 w high high low high high low low r high low high high low high low dqmul / we2 / iciord w high low high high low high low r low high high high low high low * 1 dqmuu / we3 / iciowr w low high high high low high low ce2a /ptd[6] high high high high high high high ce2b /ptd[7] high high high high high high high cke high * 2 high * 2 high * 2 high * 2 high * 2 high * 2 high * 2 wait disabled disabled disabled disabled disabled disabled disabled iois16 disabled disabled disabled disabled disabled disabled disabled a25 to a0 address command address command address command address command address command address command address command d7 to d0 invalid data invalid data invalid data valid data invalid data valid data valid data d15 to d8 invalid data invalid data valid data invalid data invalid data valid data valid data d23 to d16 invalid data valid data invalid data invalid data valid data invalid data valid data d31 to d24 valid data invalid data invalid data invalid data valid data invalid data valid data notes: 1. lower 32-mbyte access/ upper 32-mbyte access 2. normally high. low in self-refreshing.
rev. 4.00, 03/04, page 648 of 660 table b.9 pin states (pcmcia/little endian) pcmcia memory interface (area 5) pcmcia/io interface (area 5) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad-dress 2n) byte access (ad-dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad-dress 2n) byte access (ad-dress 2n + 1) word/ long-word access cs6 to cs2 , cs0 enabled enabled high enabled enabled enabled high enabled r low low low low high high high high rd w high high high high high high high high r high high high high high high high high rd/ wr w low low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled enabled rasu /ptd[1] high high high high high high high high rasl /ptd[0] high high high high high high high high casl /ptd[2] high high high high high high high high casu /ptd[3] high high high high high high high high r high high high high high high high high we0 / dqmll w high high high high high high high high r high high high high high high high high we1 / we / dqmlu w low low low low high high high high r high high high high low low low low we2 / iciord / dqmul /ptc[1] w high high high high high high high high r high high high high high high high high we3 / iciowr / dqmuu /ptc[2] w high high high high low low low low ce2a /ptd[6] high high low low high high low low ce2b /ptd[7] high high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled enabled enabled a25 to a0 address address address address address address address address d7 to d0 valid data valid data invalid data valid data valid data valid data invalid data valid data d15tod8 high-z * 2 invalid data valid data valid data high-z * 2 invalid data valid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2
rev. 4.00, 03/04, page 649 of 660 pcmcia memory interface (area 6) pcmcia/io interface (area 6) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n+1) word/ long- word access cs6 to cs2 , cs0 enabled enabled high enabled enabled enabled high enabled r low low low low high high high high rd w high high high high high high high high r high high high high high high high high rd/ wr w low low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled enabled rasu /ptd[1] high high high high high high high high rasl /ptd[0] high high high high high high high high casl /ptd[2] high high high high high high high high casu /ptd[3] high high high high high high high high r high high high high high high high high we0 / dqmll w high high high high high high high high r high high high high high high high high we1 / we / dqmlu w low low low low high high high high r high high high high low low low low we2 / iciord / dqmul / ptc[1] w high high high high high high high high r high high high high high high high high we3 / iciowr / dqmuu / ptc[2] w high high high high low low low low ce2a /ptd[6] high high high high high high high high ce2b /ptd[7] high high low low high high low low cke disabled disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled enabled enabled a25 to a0 address address address address address address address address d7 to d0 valid data valid data invalid data valid data valid data valid data invalid data valid data d15tod8 high-z * 2 invalid data valid data valid data high-z * 2 invalid data valid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 notes: 1. disabled when wcr2 register wait setting is 0. 2. unused data pins should be switched to the port function, or pulled up or down.
rev. 4.00, 03/04, page 650 of 660 table b.10 pin states (pcmcia/big endian) pcmcia memory interface (area 5) pcmcia/io interface (area 5) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/word/ long-word access byte access (ad-dress 2n) byte access (ad-dress 2n + 1) word/ long- word access byte/word/ long-word access byte access (ad-dress 2n) byte access (ad-dress 2n + 1) word/ long- word access cs6 to cs2 , cs0 enabled enabled high enabled enabled enabled high enabled r low low low low high high high high rd w high high high high high high high high r high high high high high high high high rd/ wr w low low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled enabled rasu /ptd[1] high high high high high high high high rasl /ptd[0] high high high high high high high high casl /ptd[2] high high high high high high high high casu /ptd[3] high high high high high high high high r high high high high high high high high we0 / dqmll w high high high high high high high high r high high high high high high high high we1 / we / dqmlu w low low low low high high high high r high high high high low low low low we2 / iciord / dqmul /ptc[1] w high high high high high high high high r high high high high high high high high we3 / iciowr / dqmuu /ptc[2] w high high low low low low low low ce2a /ptd[6] high high low low high high low low ce2b /ptd[7] high high high high high high high high cke disabled disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address address d7 to d0 valid data invalid data valid data valid data valid data invalid data valid data valid data d15tod8 high-z * 2 valid data invalid data valid data high-z * 2 valid data invalid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2
rev. 4.00, 03/04, page 651 of 660 pcmcia memory interface (area 6) pcmcia/io interface (area 6) 8-bit bus width 16-bit bus width 8-bit bus width 16-bit bus width pin byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n + 1) word/ long- word access byte/ word/ long- word access byte access (ad- dress 2n) byte access (ad- dress 2n+1) word/ long- word access cs6 to cs2 , cs0 enabled enabled high enabled enabled enabled high enabled r low low low low high high high high rd w high high high high high high high high r high high high high high high high high rd/ wr w low low low low low low low low bs enabled enabled enabled enabled enabled enabled enabled enabled rasu /ptd[1] high high high high high high high high rasl /ptd[0] high high high high high high high high casl /ptd[2] high high high high high high high high casu /ptd[3] high high high high high high high high r high high high high high high high high we0 / dqmll w high high high high high high high high r high high high high high high high high we1 / we / dqmlu w low low low low high high high high r high high high high low low low low we2 / iciord / dqmul / ptc[1] w high high high high high high high high r high high high high high high high high we3 / iciowr / dqmuu / ptc[2] w high high high high low low low low ce2a * 3 /ptd[6] high high high high high high high high ce2b * 3 /ptd[7] high high low low high high low low cke disabled disabled disabled disabled disabled disabled disabled disabled wait enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 enabled * 1 iois16 disabled disabled disabled disabled disabled disabled disabled disabled a25 to a0 address address address address address address address address d7 to d0 valid data invalid data valid data valid data valid data invalid data invalid data valid data d15tod8 high-z * 2 valid data invalid data valid data high-z * 2 valid data invalid data valid data d31 to d16 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 high-z * 2 notes: 1. disabled when wcr2 register wait setting is 0. 2. unused data pins should be switched to the port function, or pulled up or down. 3. the behavior of the ce pin in the big endian is the same as that in the little endian.
rev. 4.00, 03/04, page 652 of 660
rev. 4.00, 03/04, page 653 of 660 c. product lineup model marking package hd6417706f133 176-pin plastic lqfp (fp-176c) hd6417706bp133 208-pin tfbga (tbp-208a)
rev. 4.00, 03/04, page 654 of 660 d. package dimensions figures d.1 and d.2 show the sh7706 package dimensions. package code jedec jeita mass (reference value) fp-176c ? conforms 1.9 g * dimension including the plating thickness base material dimension 26.0 0.2 24 0.08 133 176 45 88 132 89 144 0.08 m 0.5 26.0 0.2 1.70 max 1.40 * 0.17 0.05 0? ? 8? 1.0 0.5 0.1 0.10 0.05 * 0.22 0.05 1.25 0.20 0.04 0.15 0.04 as of january, 2003 unit: mm figure d.1 package dimensions (fp-176c)
rev. 4.00, 03/04, page 655 of 660 0.65 0.80 0.80 12.00 12.00 0.15 4 0.2 c c 0.10 c 0.65 0.31 0.05 1.20max b a d c f e h g k j m l p n t r u 17 15 16 13 14 11 12 9 10 7 8 5 6 3 4 1 2 0.20 c a 0.20 c b b c 0.08 ab 208 0.40 0.05 m a as of january, 2003 unit: mm package code jedec jeita mass (reference value) tbp-208a ? ? 0.26 g figure d.2 package dimensions (tbp-208a)
rev. 4.00, 03/04, page 656 of 660
rev. 4.00, 03/04, page 657 of 660 index adcr ............................. 501, 550, 562, 567 adcsr........................... 499, 550, 562, 567 addra .................................................. 498 addrah ....................... 497, 550, 562, 567 addral........................ 497, 550, 562, 567 addrb .................................................. 498 addrbh ....................... 497, 550, 562, 567 addrbl........................ 497, 550, 562, 567 addrc .................................................. 498 addrch ....................... 497, 550, 562, 567 addrcl........................ 497, 550, 562, 567 addrd .................................................. 498 addrdh ....................... 497, 550, 562, 567 addrdl........................ 497, 550, 562, 567 address array......................................... 100 address translation .................................. 55 addressing modes .................................... 23 area 0 ..................................................... 197 area 1 ..................................................... 197 area 2 ..................................................... 197 area 3 ..................................................... 198 area 4 ..................................................... 198 area 5 ..................................................... 198 area 6 ..................................................... 199 auto-request mode................................ 257 avoiding synonym problems ................... 67 bamra.......................... 138, 547, 557, 564 bamrb.......................... 140, 547, 556, 564 bara ............................. 137, 547, 557, 564 barb ............................. 139, 547, 556, 564 basra........................... 147, 547, 557, 564 basrb ........................... 148, 547, 557, 564 bbra ............................. 138, 547, 557, 564 bbrb ............................. 141, 547, 557, 564 bcr1 .............................. 169, 547, 555, 565 bcr2 .............................. 172, 547, 555, 565 bdmrb.......................... 140, 547, 556, 564 bdrb ............................. 140, 547, 556, 564 betr .............................. 145, 547, 557, 564 big-endian................................................. 20 brcr.............................. 142, 547, 556, 564 brdr.............................. 147, 547, 557, 564 brsr .............................. 146, 547, 557, 564 burst mode..............................................272 bus modes ..............................................271 ccr ................................ 101, 547, 558, 564 ccr2 .............................. 102, 547, 558, 564 changing the division ratio...................300 changing the multiplication rate ...........300 channel priority ......................................259 chcr_0.......................... 247, 549, 559, 566 chcr_1.......................... 247, 550, 560, 566 chcr_2.......................... 247, 550, 560, 567 chcr_3.......................... 247, 550, 561, 567 clock synchronous operation ................389 cmcnt .......................... 284, 550, 561, 567 cmcor .......................... 284, 550, 561, 567 cmcsr........................... 283, 550, 561, 567 cmstr ........................... 283, 550, 561, 567 control registers.......................................17 cycle-steal mode....................................271 dacr ............................. 515, 550, 562, 567 dadr0 ........................... 514, 550, 562, 567 dadr1 ........................... 514, 550, 562, 567 dar_0 ............................ 246, 549, 559, 566 dar_1 ............................ 246, 550, 560, 566 dar_2 ............................ 246, 550, 560, 567 dar_3 ............................ 246, 550, 561, 567 data array...............................................108 delayed branching....................................21 dma transfer requests .........................257 dmaor.......................... 253, 550, 561, 567 dmatcr_0 ................... 247, 549, 559, 566 dmatcr_1 ................... 247, 550, 560, 566 dmatcr_2 ................... 247, 550, 560, 567 dmatcr_3 ................... 247, 550, 561, 567 dual address mode ................................263 exception codes .......................................85 expevt ........................... 87, 547, 557, 564 external request mode...........................257
rev. 4.00, 03/04, page 658 of 660 fixed mode............................................. 259 frqcr ........................... 298, 547, 556, 564 gbr.......................................................... 17 general exceptions................................... 91 general registers...................................... 15 icr0 ............................... 122, 548, 555, 565 icr1 ............................... 123, 549, 559, 566 instruction code map ............................... 46 instruction formats................................... 27 instruction set........................................... 30 interrupt response time......................... 132 interrupts................................................... 94 intevt............................ 87, 547, 558, 564 intevt2.......................... 87, 549, 559, 566 ipra ............................... 121, 548, 555, 565 iprb ............................... 121, 548, 555, 565 iprc ............................... 121, 549, 559, 566 iprd ............................... 121, 549, 559, 566 ipre ............................... 121, 549, 559, 566 irr0 ............................... 125, 549, 559, 566 irr1 ............................... 127, 549, 559, 566 irr2 ............................... 128, 549, 559, 566 little-endian............................................... 20 mac ......................................................... 16 mcr ............................... 180, 548, 555, 565 mmucr........................... 58, 547, 558, 564 mode 0.................................................... 295 mode 1.................................................... 295 mode 2.................................................... 295 mode 7.................................................... 295 multiple virtual memory mode ............... 55 on-chip peripheral module request...... 258 pacr.............................. 463, 551, 562, 567 padr ............................. 479, 551, 563, 568 pbcr.............................. 464, 551, 562, 567 pbdr.............................. 481, 551, 563, 568 pc ............................................................. 16 pccr...................................... 466, 551, 567 pcdr.......................482, 551, 562, 563, 568 pcmcia................................................. 165 pcr................................. 185, 548, 555, 565 pdcr.............................. 467, 551, 562, 567 pddr ............................. 484, 551, 563, 568 pecr .............................. 469, 551, 562, 567 pedr .............................. 485, 551, 563, 568 pfcr............................... 470, 551, 562, 567 pfdr .............................. 487, 551, 563, 568 pgcr .............................. 472, 551, 562, 568 pgdr.............................. 488, 551, 563, 568 phcr .............................. 473, 551, 562, 568 phdr.............................. 490, 551, 563, 568 pjcr ............................... 475, 551, 562, 568 pjdr ............................... 492, 551, 563, 568 pr ............................................................. 16 processor modes ....................................... 50 pteh ................................ 56, 547, 558, 564 ptel................................. 57, 547, 558, 564 r64cnt.......................... 328, 548, 554, 565 rcr1 .............................. 338, 548, 555, 565 rcr2 .............................. 339, 548, 555, 565 rdayar........................ 336, 548, 555, 565 rdaycnt ..................... 331, 548, 554, 565 resets ........................................................ 90 rfcr .............................. 192, 548, 556, 565 rhrar........................... 334, 548, 555, 565 rhrcnt ........................ 329, 548, 554, 565 rminar ........................ 333, 548, 555, 565 rmincnt ...................... 329, 548, 554, 565 rmonar....................... 337, 548, 555, 565 rmoncnt .................... 331, 548, 554, 565 round-robin mode ................................ 259 rsecar......................... 332, 548, 555, 565 rseccnt ...................... 328, 548, 554, 565 rtcnt ........................... 191, 548, 555, 565 rtcor ........................... 191, 548, 556, 565 rtcsr............................ 188, 548, 555, 565 rwkar.......................... 335, 548, 555, 565 rwkcnt ....................... 330, 548, 554, 565 ryrcnt ........................ 332, 548, 555, 565 sar_0............................. 246, 549, 559, 566 sar_1............................. 246, 550, 560, 566 sar_2............................. 246, 550, 560, 567 sar_3............................. 246, 550, 561, 567 scbrr............................ 366, 549, 553, 566 scbrr2.......................... 439, 551, 553, 568 scfcr2 .......................... 443, 551, 553, 568
rev. 4.00, 03/04, page 659 of 660 scfdr2.......................... 445, 551, 553, 568 scfrdr2....................... 426, 551, 553, 568 scftdr2 ....................... 426, 551, 553, 568 scpcr.................... 364, 476, 551, 562, 568 scpdr.................... 365, 493, 551, 563, 568 scrdr ........................... 352, 549, 553, 566 scrsr.................................................... 352 scrsr2.................................................. 426 scscmr ........................ 403, 549, 553, 566 scscr............................ 355, 549, 553, 566 scscr2.......................... 429, 551, 553, 568 scsmr........................... 353, 549, 553, 566 scsmr2......................... 426, 551, 553, 568 scssr .................... 359, 404, 549, 553, 566 scssr2 .......................... 431, 551, 553, 568 sctdr ........................... 352, 549, 553, 566 sctsr .................................................... 352 sctsr2 .................................................. 426 sdbpr.................................................... 519 sdbsr.................................................... 520 sdir ............................... 519, 551, 563, 568 sdmr..................................... 188, 548, 556 self-refreshing ....................................... 223 single address mode.............................. 269 single virtual memory mode................... 55 space allocation..................................... 162 spc ........................................................... 17 sr..............................................................17 ssr ...........................................................17 stbcr............................ 532, 547, 556, 564 stbcr2.......................... 534, 547, 556, 564 system registers .......................................16 tcnt_0 .................................. 549, 553, 566 tcnt_1 .................................. 549, 554, 566 tcnt_2 .......................... 318, 549, 554, 566 tcor_0.......... 314, 317, 318, 549, 553, 565 tcor_1.......... 314, 317, 318, 549, 554, 566 tcor_2.......................... 317, 549, 554, 566 tcpr_2 .......................... 318, 549, 554, 566 tcr_0............................. 314, 549, 553, 566 tcr_1............................. 314, 549, 554, 566 tcr_2............................. 314, 549, 554, 566 tea................................... 57, 547, 558, 564 tocr.............................. 312, 549, 553, 565 tra .................................. 87, 547, 557, 564 tstr............................... 313, 549, 553, 565 ttb................................... 57, 547, 558, 564 vbr ..........................................................17 virtual address map.................................53 virtual memory system..............................51 wcr1 ............................. 174, 548, 555, 565 wcr2 ............................. 177, 548, 555, 565 wtcnt .......................... 304, 547, 556, 564 wtcsr................................... 304, 547, 556
rev. 4.00, 03/04, page 660 of 660
renesas 32-bit risc microcomputer hardware manual sh7706 group publication date: 1st edition, september 2001 rev.4.00, march 22, 2004 published by: sales strategic planning div. renesas technology corp. edited by: technical documentation & information department renesas kodaira semiconductor co., ltd. ? 2004. renesas technology corp., all rights reserved. printed in japan.
colophon 1.0 sales strategic planning div. nippon bldg., 2-6-2, ohte-machi, chiyoda-ku, tokyo 100-0004, japan http://www.renesas.com renesas technology america, inc. 450 holger way, san jose, ca 95134-1368, u.s.a tel: <1> (408) 382-7500 fax: <1> (408) 382-7501 renesas technology europe limited. dukes meadow, millboard road, bourne end, buckinghamshire, sl8 5fh, united kingdom tel: <44> (1628) 585 100, fax: <44> (1628) 585 900 renesas technology europe gmbh dornacher str. 3, d-85622 feldkirchen, germany tel: <49> (89) 380 70 0, fax: <49> (89) 929 30 11 renesas technology hong kong ltd. 7/f., north tower, world finance centre, harbour city, canton road, hong kong tel: <852> 2265-6688, fax: <852> 2375-6836 renesas technology taiwan co., ltd. fl 10, #99, fu-hsing n. rd., taipei, taiwan tel: <886> (2) 2715-2888, fax: <886> (2) 2713-2999 renesas technology (shanghai) co., ltd. 26/f., ruijin building, no.205 maoming road (s), shanghai 200020, china tel: <86> (21) 6472-1001, fax: <86> (21) 6415-2952 renesas technology singapore pte. ltd. 1, harbour front avenue, #06-10, keppel bay tower, singapore 098632 tel: <65> 6213-0200, fax: <65> 6278-8001 renesas sales offices
sh7706 group hardware manual


▲Up To Search▲   

 
Price & Availability of HD6417706BP133V

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X